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

    (@xnau)

    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.

Viewing 1 replies (of 1 total)
  • The topic ‘Force a value on a field’ is closed to new replies.