Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

passing value to form (app)

edited August 2014 in Apps

In a custom made app I embedded a form in a view using

{! form/index?id=2 !}

The view shows information about an item say for example:

{{ item->id }}
{{ item->title}}

My goal would be to insert those variable in the form possibly using "Default value".

Is that possible?

Thanks for any help.


  • I think you would have to set them by setting the values in $_POST, for example:

    <?php $_POST['title'] = 'Default value'; ?>

    I didn't test it myself, but that seems like it should work.

  • Sorry I have explained myself badly.

    Form builder (app) allows us to set a default value for each field of the form.

    The form in question is called by the template (that displays the data of the item) from which it receives the relevant data in this way:

    {! form/index?id=2&var1=[item->id]&var2=[item->title] !}

    I was wondering if there is a way to assign a passed value (var1, var2) to the default of one of the form fields (without tampering form app).


  • That doesn't work I'm afraid. I tested setting it via $_POST and it doesn't work either, because the request method isn't POST until the form has actually been submitted.

    To set defaults like this would take a bit of customization to the form/index handler.

Sign In or Register to comment.