[DONE] retrieve form variables

A place to make for-pay "CMS made simple" job offerings
Post Reply
mw
Forum Members
Forum Members
Posts: 159
Joined: Mon Aug 25, 2008 8:38 pm
Location: Comox Valley, BC, Canada

[DONE] retrieve form variables

Post by mw »

note: I have modified this post as it's not really a javascript problem but a formbuilder problem.

I need to be able to retrieve Calendar event titles and pass them along to formbuilder.
The user reads a event and can choose "Register for this event" and be taken to a form that is populated with some of the details like event title and date where they fill out name etc and it sends an email with user info as well as event details.
Also a "register page" which will list all the event titles and dates (as in the below code) so that the user can select multiple choices and have that info emailed.

working so far (testing with generic php mail form) I have:

Code: Select all

<form method="post" action="lib/mailer.php"> 
Name: <input name="name" size="19" type="text" /><br /> <br />
 E-Mail: <input name="email" size="19" type="text" /><br /> <br /> 

{capture assign='tmp'}
 {cms_module module="Calendar" display='list"}
 {/capture}
 {foreach from=$events key=key item=event}
 <input name="course_list[]" value="{$event.event_title}" type="checkbox" />{$event.event_title} <br />
 {/foreach}
 <br /> 

Message:<br /> <textarea rows="9" name="message" cols="30"></textarea><br /> <br /> 
<input value="Submit" name="submit" type="submit" /></form>
you can see the above working here:
http://www.uidds.com/index.php?page=submenu
and the above will send an email with the username,email and course titles (event titles)
but I would really much rather use Formbuilder.


the events calendar will end up looking like:
http://www.vicdds.ca/activities/category/upcoming/
and the register page like:
http://www.vicdds.ca/registration.php


If someone can do this with formbuilder,I'm willing to pay $100 -> $150
Last edited by mw on Wed Jan 21, 2009 1:34 am, edited 1 time in total.
rhys
Forum Members
Forum Members
Posts: 40
Joined: Thu Nov 24, 2005 4:16 pm

Re: retrieve form variables

Post by rhys »

Hey MW

I'm trying to do a similar thing at the moment - use 1 formbulder form as a 'register for this event' form - for multiple events. I've got a solution for the first bit for you:

Passing Event Title from the calendar

I've made each event using the Calendar module. Users click the calendar title/summary then are taken to the full details on [read mmore]. At the bottom of each event (content) I write: "Complete the form below to register for this event" then put the following smarty tag {cms_module module='FormBuilder' form='events' value_fld93='conference'}. This calls the form into the event content, then passes the variable 'conference' to the form field whose Id is 93. (go to Configuration tab in Formbuilder and choose 'Show Ids') to find out what the Id of your relevant form field is. So basically you call the formbuilder module inside the calendar - great for the user as they don't have to click anywhere to register.

You should be able to pass other variables to form fields in the same way.

From there I'm trying to write to a flat file with the variable name passed from the calendar. This is where I'm stuck. I tried to write to a flat file with $eventtitle.txt (the variable name) but it just gives me _eventtitle.txt, rather than 'conference' or 'party'.

I'm still working on it and will let you know if I get any further. Good luck
rhys
mw
Forum Members
Forum Members
Posts: 159
Joined: Mon Aug 25, 2008 8:38 pm
Location: Comox Valley, BC, Canada

Re: retrieve form variables

Post by mw »

@rhys
Thanks for sharing your experience. I did at first put the form right inside the event template but I found it restrictive in the layout.
I would much prefer to have that kind of functionality from formbuilder but have it in a separate stand alone (register) page

I resorted to posting here as I found many people like yourself attempting to do the same thing.
so I want to make it clear that whoever does the job that the solution will be posted in the forum under Tips and Tricks  for anyone else to also freely use.


also have you seen this post?
http://forum.cmsmadesimple.org/index.php/topic,15554.msg89590.html#msg89590

That should grab {$event.event_title} as a var like {$classtitle} which should be able to be used as {$classtitle}.txt ?
Last edited by mw on Mon Jan 05, 2009 8:33 pm, edited 1 time in total.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am
Location: London

Re: retrieve form variables

Post by applejack »

For an example of passing a calendar date to formbuilder see

http://www.seafin.co.uk/availability/

click on a date

Website Design & Production
http://www.applejack.co.uk
mw
Forum Members
Forum Members
Posts: 159
Joined: Mon Aug 25, 2008 8:38 pm
Location: Comox Valley, BC, Canada

Re: retrieve form variables

Post by mw »

applejack wrote: For an example of passing a calendar date to formbuilder see

http://www.seafin.co.uk/availability/

click on a date
I like how you did that, perhaps you will share?
currently calguy1000 has taken on the job and the formbuilder will be updated as a result.
how to pass the event title, date etc as hidden fields and as static text/labels onto formbuilder and email fields...
will be posted in the tips and tricks forum as soon as it's polished up.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: retrieve form variables

Post by calguy1000 »

Actually, it's very simple:

This is using the capability I added into FB previously to pass default field values into formbuilder on the tag.
73 is the id of the field I want to populate with the results of the form.    You should be able to take this example and expand it.

Code: Select all

{if !isset($smarty.post.testsubmit)}
<h3>Manually Created Form - Imagine the values for the checkboxes came from Calendar</h3>
<form method="post">
  <input name="opts[]" type="checkbox" value="Course 1" />Course 1<br />
  <input name="opts[]" type="checkbox" value="Course 2" />Course 2<br />
  <input name="opts[]" type="checkbox" value="Course 3" />Course 3<br />
  <input name="testsubmit" type="submit" value="Submit" />
</form>
{else}
<h3>Formbuilder test form</h3>
{cms_module module='FormBuilder' form='test'  value_fld73=$smarty.post.opts}
{/if} 
Now..... if your formbuilder form was on a different page.... then you would need a UDT that would allow putting the $smarty.post.opts variable into the session (it's a simple UDT, think I've got it around someplace)..... and then you would use $smarty.session.opts instead of $smarty.post.opts

Verry simple.
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
Location: London

Re: retrieve form variables

Post by applejack »

In the Calendar module file function.displaycalendar.php

Replace

$days[$i]['url'] = $module->CreateLink($id, 'default', $detailpage!=''?$detailpage:$returnid, $contents='', $parms, '', true, $inline);

With

$days[$i]['url'] = "talk-to-us/?date=$i-$parms[month]-$parms[year]";

In this case talk-to-us is the url of the page with the form and date of course is a form field. On the form page looks like

{if $smarty.get.date} {cms_module module='FormBuilder' form='talk' value_fld25=$smarty.get.date} {else} {cms_module module='FormBuilder' form='talk'} {/if}

I'm sure Calguy has a better solution but this was a quick hack as it does what I needed it to do for this job.

And Calguy I would be interested in seeing the UDT that would allow putting the $smarty.post.opts variable into the session if you can find it.

I didn't know you coded Formbuilder I thought it was someone else but it is an outstanding module.

For anyone who doesn't know what it can do you can see a more complex example at http://www.goringberry.co.uk/contact/contact-form/
Last edited by applejack on Fri Jan 09, 2009 12:32 am, edited 1 time in total.

Website Design & Production
http://www.applejack.co.uk
mw
Forum Members
Forum Members
Posts: 159
Joined: Mon Aug 25, 2008 8:38 pm
Location: Comox Valley, BC, Canada

Re: retrieve form variables

Post by mw »

calguy1000 wrote: Actually, it's very simple:

This is using the capability I added into FB previously to pass default field values into formbuilder on the tag.
73 is the id of the field I want to populate with the results of the form.    You should be able to take this example and expand it.

Code: Select all

{if !isset($smarty.post.testsubmit)}
<h3>Manually Created Form - Imagine the values for the checkboxes came from Calendar</h3>
<form method="post">
  <input name="opts[]" type="checkbox" value="Course 1" />Course 1<br />
  <input name="opts[]" type="checkbox" value="Course 2" />Course 2<br />
  <input name="opts[]" type="checkbox" value="Course 3" />Course 3<br />
  <input name="testsubmit" type="submit" value="Submit" />
</form>
{else}
<h3>Formbuilder test form</h3>
{cms_module module='FormBuilder' form='test'  value_fld73=$smarty.post.opts}
{/if} 
Now..... if your formbuilder form was on a different page.... then you would need a UDT that would allow putting the $smarty.post.opts variable into the session (it's a simple UDT, think I've got it around someplace)..... and then you would use $smarty.session.opts instead of $smarty.post.opts

Verry simple.
If it's so simple then why doesn't it work on my site after I paid you $75.00US ?
you simply ignore any email since I sent you the money.
you left a form on my site that does nothing but generate a string of errors.
not very professional by any means.

I am back to square 1 again .
tyman00
Power Poster
Power Poster
Posts: 906
Joined: Tue Oct 24, 2006 5:59 pm

Re: retrieve form variables

Post by tyman00 »

He took the time to help you out and pushed off other (already paid) jobs so he could help you out. Be a little more patient and realize that a one hour job isn't going to get him to drop everything he is doing when you have a problem with something that worked for him. Especially over the weekend.
If all else fails, use a bigger hammer.
M@rtijn wrote: This is a community. This means that we work together and have the same goal (a beautiful CMS), not that we try to put people down and make their (voluntary) job as difficult as can be.
mw
Forum Members
Forum Members
Posts: 159
Joined: Mon Aug 25, 2008 8:38 pm
Location: Comox Valley, BC, Canada

Re: retrieve form variables

Post by mw »

tyman00 wrote: He took the time to help you out and pushed off other (already paid) jobs so he could help you out. Be a little more patient and realize that a one hour job isn't going to get him to drop everything he is doing when you have a problem with something that worked for him. Especially over the weekend.
Your right of course, however it has actually been over a week with no word (jan 5th)
and I had to Hire someone else.
That being said I have finally heard back this morning.
I apologize if my frustrations have offended anyone
mw
Forum Members
Forum Members
Posts: 159
Joined: Mon Aug 25, 2008 8:38 pm
Location: Comox Valley, BC, Canada

Re: [DONE] retrieve form variables

Post by mw »

The solution has been posted to tips and tricks
Passing variable from calendar to FormBuilder
Post Reply

Return to “Help Wanted (commercial)”