Page 1 of 1

[Solved] Sent url value with form

Posted: Mon Mar 17, 2014 2:02 pm
by Masweb
On serveral website pages I've made a button to sign in or get infomation. With this button I sent some infomation of that page in the url.

On the form page I can print that information.
But I can't get it to work to sent this infomation with the form.(Formbuilder)

Is that possible and how do I do this?

This is the code I'm getting the infomation in the url:

Code: Select all

<a href="{cms_selflink href='inschrijven'}?value={$entry->title|cms_escape}-{$entry->postdate|cms_date_format}">inschrijven</a>

This is the code for getting te information out of the url

Code: Select all

if ( isset( $_GET['value'] ) ) { // controleren of $_GET['value'] bestaat
  echo '<p>' . $_GET['value'] . '</p>';
  }
else {
  echo '<p>Uw vraag is verzonden!</p>';
  }

Re: Sent url value with form

Posted: Mon Mar 17, 2014 3:07 pm
by velden
You can pre-populate a FormBuilder field with a value. Read FB module help -> Advanced tab -> 'Passing Default Values to Forms'

You can use Smarty too to get the value from url (maybe you want to do some validation first).

Example (read help first):

Code: Select all

{FormBuilder form='my_form' value_FIELDNAME=$smarty.get.value}

if that does not work:
{FormBuilder form='my_form' value_FIELDNAME={$smarty.get.value}}
Note that you need to create the field in Form Builder. I think you should use a field of type 'hidden field'.

Re: Sent url value with form

Posted: Mon Mar 17, 2014 3:41 pm
by Masweb
Great! Works for me! Thanks. :)