Jump to content

Setting values in $_GET ($input->get('xxx')) for form builder


Recommended Posts

Hi,

I have a job template that embeds an application form from FormBuilder. I need to get some info about the role into the form, and am doing this by inserting the values into the querystring in the template, then configuring the form to pick up querystring values and put them in a couple of hidden fields:

$input->get['vacancy'] = $page->title;
$input->get['pageid'] = $page->id;

This does feel a bit odd, but I couldn't think of another way as I can't get inside the form iframe.

Now, it works, except sporadically, it doesn't and tha values are just blank. I'm tearing my hair out as this is server-side and I wouldn't expect it to sometimes work and sometimes not, so...

  • Can anyone think of a reason why this would sometimes fail?
  • Can anyone recommend a better solution for getting values into the form? previously I had the values appended to site links to the jobs, but the problem is it needs to work if you just arrive at a job from elsewhere, so has to be self-contained.

TIA

Crawford.

Link to post
Share on other sites

If you have the "Preset field values from GET variables?" setting checked you can use embed option B (Template Embed) and set field values in a second argument to $forms->embed()

echo $forms->embed('your_form_name', [ 'vacancy' => $page->title, 'pageid' => $page->id ]); 

 

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...