• Resolved kaepora

    (@kaepora)


    I’m doing two forms using two templates which is fine (I’ve been browsing you’re support threads – lots of info making the plugin extremely customisable!).

    However I’d like to require a couple of fields in one form/template but not another. I saw you could dynamically set the ‘type’ of a field on the record template from hidden to text using:
    $this->record->fields['fieldname']->form_element = 'text-line'

    Can a similar method be used to set the validation property of a field to required in the signup template, even if it’s not set to be required in the WP backend? Something like:
    $this->fields['fieldname']->validation = 'yes'

    I’ll be able to try some things out myself tomorrow, but if you can help that would be great!

    https://www.ads-software.com/extend/plugins/participants-database/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author xnau webdesign

    (@xnau)

    kaepora,

    No, this isn’t possible because the validation happens after the page is submitted (server-side) and all the validation settings will be refreshed. Your best bet would be to use Javascript…the jquery validation plugin makes this very easy.

    Plugin Author xnau webdesign

    (@xnau)

    It’s easy to add the validation javascript to the template, but you’d probably want to include the jquery validation plugin in your theme functions so it goes in at the right place.

    Thread Starter kaepora

    (@kaepora)

    OK, no problem, thanks for the help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Set Required Fields Dynamically’ is closed to new replies.