Jump to content

Set table value but don't save


DrQuincy
 Share

Recommended Posts

I have this code:

$formPage = wire('pages')->get('/forms/contact/');
$formPage->of(false);

$formPage->formFields->get('id=1075')->formFieldLabel = '<strong>Test</strong>'; // This works
$formPage->formFields->get('id=1075')->formFieldAttributes->get('property=placeholder')->value = 'New placeholder'; // This does work

echo $formPage->formFields->get('id=1075')->formFieldAttributes->get('property=placeholder')->value; // Echos old value rather than 'New placeholder'

I have forms stored in a template. I want to be able to dynamically override some of the values in the page/ form file but I don't wish to save them. The reason being I pass the \ProcessWire\Page (form) object to a function that creates the HTML for the form. Saving it would alter the form in the database whereas I just want to do it for this request only.

In this case formFields is a repeater and formFieldAttributes in a Pro Fields Table field.

Is this possible?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...