The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Participants Database
[resolved] Set Required Fields Dynamically (4 posts)

  1. kaepora
    Posted 3 years ago #

    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!


  2. xnau webdesign
    Plugin Author

    Posted 3 years ago #


    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.

  3. xnau webdesign
    Plugin Author

    Posted 3 years ago #

    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.

  4. kaepora
    Posted 3 years ago #

    OK, no problem, thanks for the help!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Participants Database
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic