Spacing between lines / Error State does not display correctly

  • seventhree
    Asked on December 11, 2020 at 3:12 PM

    Hi,

    My form naturally has a space between name and email

    1607717212 5fd3d15c8bdbd form Screenshot 10

    Error state toggled

    1607717289 5fd3d1a9271da form error stat Screenshot 21


    The email field has id: input_4. when i reduce the margin top, it displays correctly but error state hides the email placeholder

    1607717371 5fd3d1fb47467 form new Screenshot 32

    1607717391 5fd3d20f9acf8 form new error  Screenshot 43

    1607717408 5fd3d2206c2ad form css Screenshot 54


    Looking at my css, is there a better way to write some of these?

    Hiding the required field * ( i used form label top display none)

    zero margin for top and bottom of form (form buttons wrapper and page section each have margin -30px, etc)

    Any feedback is greatly appreciated.

    Thank you!

  • Gaetan_B
    Replied on December 11, 2020 at 4:51 PM

    Hello,

    Thank you for reaching out.


    The reason for this behavior is that you're targeting the "child element". So when you push it using margin-top, it gets cut off by his parent.


    You should try to target the #id_4 instead of the #input_4.


    This will affect the parent, and the weird behavior you're experiencing will disappear.


    Gaetan

  • seventhree
    Replied on December 11, 2020 at 5:12 PM

    Hello,

    Can you please check the other css as well?

    I am also getting this error when I try to submit without completing the form.

    As you can see, it hides the name field completely

    1607724660 5fd3ee74724f0 Screenshot 2020 Screenshot 10

    Is there a way to remove all padding, margins from a form instead of using these 2 for example?

    1607724726 5fd3eeb624b05  Screenshot 21


    Thanks


  • Jed_C
    Replied on December 11, 2020 at 8:06 PM

    Can you please try this CSS and see if this works for you.

    @media screen and (max-width: 768px)
    .pageLogo-mobile, ul.page-section {
      max-width: inherit;
      margin-top: 43px !important;
    }

    1607735197 5fd4179d49895 Clone of Form   Screenshot 10

    Guide: https://www.jotform.com/help/117-How-to-Inject-Custom-CSS-Codes

    Let us know how it goes.

  • seventhree
    Replied on December 11, 2020 at 8:29 PM

    Hi,

    Here's the form, and its inside a narrow div:

    http://emergeenergysolar.com/v1.html

    I removed the first part since its always the same size on mobile vs desktop and I was left with this:

    ul.page-section {
      max-width: inherit;
      margin-top43px !important;
    }


    This fixes that problem but it leaves a 43px gap on the top which is not what we want.

    Is there a JS code I could add if errors are shown and that message pops up?

    Other ideas?

    Thanks,

  • Jed_C
    Replied on December 11, 2020 at 9:44 PM

    How about hiding the error bar since it's redundant and at the same time showing the error below the field. In my opinion, error bar would be beneficial for long forms due to the "See Errors" button, but for short forms like this, you can just hide it.

    If you are ok with that, you can disable it in form settings.

    1607740985 5fd42e39e8a75 The Easiest Onl Screenshot 10

  • seventhree
    Replied on December 11, 2020 at 9:55 PM

    That is a great solution!

    I agree on redundancy part, this is perfect.

    Thank you!