Page 2 of 2

Re: HowTo set in FormBuilder input-hidden=UDT-value ?

Posted: Wed Apr 09, 2014 6:18 pm
by faglork
uniqu3 wrote:Have you tried using strval on variable, to truly get string returned, even i haven't faced any issues with FB 0.7.3 or earlier when used with value_* parameter, but i do always use ID so value_fldIDNUMBER.
Hmm, I wonder.

- did you *dynamically* insert a new value?
- does it still work with 1.11.10 / FB 0.74 ?

And: can you show us a site which uses this? We could try and analyze headers/post parameters.

Cheers,
Alex

Re: HowTo set in FormBuilder input-hidden=UDT-value ?

Posted: Wed Apr 09, 2014 6:34 pm
by calguy1000
You guys are over-thinking a simple problem.

A: The value_XXXX=something only allows you to set a default value for a field ONLY when it is first rendered. Your form doesn't get rendered when the submit button is pressed.

B: The solution is quite simple:
1. Create a hidden field in your form.
2. Create a UDT disposition field (set it as the first disposition so that it is processed before any other disposition, like sending emails etc).
3. In your UDT modify the value of the hidden field created in step 1.

Step 3 is left as an exercise to the user.

Re: HowTo set in FormBuilder input-hidden=UDT-value ?

Posted: Wed Apr 09, 2014 7:22 pm
by faglork
calguy1000 wrote:You guys are over-thinking a simple problem.

A: The value_XXXX=something only allows you to set a default value for a field ONLY when it is first rendered. Your form doesn't get rendered when the submit button is pressed.
Sorry, I don't understand this.

The scenario is:

I have several pages with information about several events. I want to link from these pages to a page with a form to inquire more information about the event. I need to tell the form on this other page which event is in question. So I use a POST or GET variable, e.g. $event, the value is, say, "Event Nr. 12".

On the page containing the form, I call the Formbuilder module, the form it uses has a hidden field ID 41 with a default value.

So far, everything is ok.

Now I override this value with
{FormBuilder form="anfrage" value_fld41="Event Nr. 12"}
--> when I manually insert this, all is well.

BUT: when I use a POST (or GET) parameter, it fails:
{FormBuilder form="anfrage" value_fld41=$smarty.post.event}
--> the data apparently do not even reach the FormBuilder module, no mail is sent, not even the field validation for mandatory fileds kicks in.

In both cases, the generated form is identical, as are the POST data sent by the form.

My question is:
calguy1000 wrote:The value_XXXX=something only allows you to set a default value for a field ONLY when it is first rendered. Your form doesn't get rendered when the submit button is pressed.
How does this apply to this problem? As far as I understand it, the form is only rendered ONCE (by the module call). We do not try to render the form by pressing the submit button ...

Can you please explain what you meant? I really don't understand this.

Cheers,
Alex

Re: HowTo set in FormBuilder input-hidden=UDT-value ?

Posted: Wed Apr 09, 2014 7:41 pm
by faglork
Ha!

You got me on the right track!

It is really simple, but not at all as explained in the module help ...

- create a hidden field

- as VALUE enter a smarty tag, in my case: {$smarty.post.pbanfrage}

- in the Advanced tab, set "Process smarty tags within field?"

TaDaa!

--> the POST parameter gets inserted
--> it is sent as string, not as array

THX, Calguy! You saved my day!

Cheers,
Alex