[SOLVED] How to pass variable values to FormBuilder from a URL ?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

[SOLVED] How to pass variable values to FormBuilder from a URL ?

Post by applejack »

Hi

I am trying to find out how to pass variable values to a FormBuilder form from a URL. In Perl it would just be something like
link?var1=value1&var2=value2  etc etc Ideally I would like to pass it to a drop down selection box so that a specific option within it is selected depending upon the value passed to it, but passing values to hidden fields should be fine for now.
Last edited by applejack on Fri Feb 15, 2008 4:35 pm, edited 1 time in total.

Website Design & Production
http://www.applejack.co.uk
alby

Re: How to pass variable values to FormBuilder from a URL ?

Post by alby »

applejack wrote: I am trying to find out how to pass variable values to a FormBuilder form from a URL.
Check in FormBuilder for pass variable to field and pass $smarty.get.your_variable

Alby
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: How to pass variable values to FormBuilder from a URL ?

Post by applejack »

Hi Alby

Thanks for for getting back to me. I already did check in the help menu of Form Builder and what there is there I either didn't understand i.e. passing default values to forms or didn't answer what I need i.e. passing values from a URL. I also searched every reference to FormBuilder in the Forum but couldn't find an answer.

I would be very very grateful if you could explain this more fully and also pass $smarty.get.your_variable with a simple example.

This is crucial to me as passing data to pages and forms is half of what websites I do are about and which I have been doing using Perl for years.

Website Design & Production
http://www.applejack.co.uk
alby

Re: How to pass variable values to FormBuilder from a URL ?

Post by alby »

applejack wrote: Thanks for for getting back to me. I already did check in the help menu of Form Builder and what there is there I either didn't understand i.e. passing default values to forms or didn't answer what I need i.e. passing values from a URL. I also searched every reference to FormBuilder in the Forum but couldn't find an answer.
Have you search in Forum for:
pass variable "to FormBuilder"

Alby
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: How to pass variable values to FormBuilder from a URL ?

Post by applejack »

Hi Alby

I found this http://forum.cmsmadesimple.org/index.ph ... 554.0.html which looks like it might do the trick, I shall have to see how it works when I get the chance to try it. Thanks for your help as always.

Website Design & Production
http://www.applejack.co.uk
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: How to pass variable values to FormBuilder from a URL ?

Post by calguy1000 »

Code: Select all

{cms_module module='formbuilder' form='my_form' value_myField=$smarty.get.myvariable}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: How to pass variable values to FormBuilder from a URL ?

Post by applejack »

Hi Calguy

Thanks that worked apart from if the field has an underscore in it. What is the syntax to deal with such field names i.e. Your_Name as I have tried ever combination which I can think of i.e. below the Fruit part works but value_Your_Name does not.

{cms_module module='FormBuilder' form='contact_us' value_Fruit=$smarty.get.test value_Your_Name=$smarty.get.myname}

passing it as

index.php?page=contact&test=apple+orange&myname=peter
Last edited by applejack on Thu Feb 14, 2008 7:52 pm, edited 1 time in total.

Website Design & Production
http://www.applejack.co.uk
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: How to pass variable values to FormBuilder from a URL ?

Post by applejack »

Ok I managed to sort it out using value_fldNUMBER

Website Design & Production
http://www.applejack.co.uk
User avatar
lollipop27
Forum Members
Forum Members
Posts: 237
Joined: Wed Sep 12, 2007 4:09 pm

Re: How to pass variable values to FormBuilder from a URL ?

Post by lollipop27 »

Hi applejack,

i'm having about the same problem since my field names have a space in between (like 'Desired language')...
applejack wrote: Ok I managed to sort it out using value_fldNUMBER
What exactly do you mean by this? can I call the field by something else than value_MyFieldName??

Thanx.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: How to pass variable values to FormBuilder from a URL ?

Post by applejack »

Hi Lollipop

In the overall configuration settings for Form Builder here is an option which says Show Field IDs so have that checked. Then in the Main view where you create the form fields you can see each fields id number. That is the number to use i.e. value_fld39. I know it is a bit confusing as the other references in Form Builder to the fields as numbers have an underscore after fld and before the number.

If you work out how to have a drop down selection box pre selected by passing a value to it please let me know.

Also I would like to be able to change the destination email address by passing a value to it. I have done this by using the option *Email to User-Supplied Email Address passing a value to it which is a key for an email address (so as to hide the email addresses) and then in the call to form builder doing a replace of the key by the actual email address. This works for multiple keys and email addresses. The only problem is that if there is no key sent to Form Builder, when submitting the form Form Builder doesn't revert to the default destination address and the submission fails. I have not worked out if there is a way to overcome this yet. (If you see this dev's please note). E.G.

{cms_module module='FormBuilder' form='contact_us' value_Company=$smarty.get.test value_fld39=$smarty.get.testing value_Useremail=$smarty.get.useremail|replace:'key1':'my@emailaddress.co.uk'|replace:'key2':'another@emailaddress.co.uk'|replace:'key3':'mail@emailaddress.co.uk'}

Website Design & Production
http://www.applejack.co.uk
User avatar
lollipop27
Forum Members
Forum Members
Posts: 237
Joined: Wed Sep 12, 2007 4:09 pm

Re: How to pass variable values to FormBuilder from a URL ?

Post by lollipop27 »

Well I have a dropdownbox (.... etc, right?) preselected, I just pass the value on....

Check your code generated from the formbuilder - it uses valus in the option tag



AAA


BBB



You gotta pass on '2' not 'BBB' to preselect 'BBB'
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: How to pass variable values to FormBuilder from a URL ?

Post by applejack »

Hi Lollipop

Yes I tried this yesterday using a number and didn't work but just tried again and it did. Probably a typo somewhere.

Website Design & Production
http://www.applejack.co.uk
Post Reply

Return to “CMSMS Core”