WordPress.org

Ready to get started?Download WordPress

Forums

Participants Database
Force a value on a field (2 posts)

  1. manikor
    Member
    Posted 1 year ago #

    Is there a way I can force a value in a text item on a sign up form?

    IE, depending on if the user is coming from the page /page1 or /page2 I'd like the field to populate with "one" or "two."

    I couldn't find a way to do this on the fly.

    http://wordpress.org/extend/plugins/participants-database/

  2. xnau
    Member
    Plugin Author

    Posted 1 year ago #

    Using a hidden field with a dynamic value, you can capture the page the form is on and save that with the submission-- that's the simplest way to do it. But that's not quite what you asked for. If you want to change that value to something different before it's stored, you'll need to create a custom plugin template. In that template, set the value of the field to your preferred value based on the $post->post_name value. You can set the initial value of any field by altering the record object before the form is printed.

    For instance, if your field is named 'page' and it's in the 'main' group, the value you want to change is: $this->record->main->fields->page->value

    When the form is shown, it will be set to your value.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic