• Bubba

    (@applebag)


    I have a form the allows 2 options; I use a selection menu to have jQuery display a respective required field dependent on what’s selected, hiding the other one from view.

    The Form is here.

    What I want to do is mark the visible field as required while marking hidden field as not required whenever a different menu item is selected. If I just mark both of them by default as required it’ll always fail since one won’t be filled.

    Example: When I select “attachment”, the attachment field shows and I want it marked as required, while unmarking the following field as required;

    But if I select “Paste a link” from the menu, do the opposite; unmark the attachment filed as required, and mark the newly shown text line as required.

    Hopefully that wasn’t written too confusing, viewing the form is probably a lot easier to understand what I’m describing.

    Is there some way via jQuery to mark/unmark fields as required?

    thanks

    https://www.ads-software.com/plugins/si-contact-form/

  • The topic ‘Set a field as Required via jQuery?’ is closed to new replies.