0

I had a question for a project I am finishing for a client. He would like it so that every time a user clicks on "Sign Up Today" for the given workshop (http://yft.ac/upcoming-workshops/), the name of the workshop is somehow transferred over the contact form (http://yft.ac/contact-us/).

Now the workshop page is just a simple table with a button pointing to the contact us page, and the contact us page is powered by a simple Gravity Forms form.

Is there anyway of doing this either by using Gravity Forms or not? I'm not the best at PHP and have not yet been able to find a way to accomplish this.

Thanks in advance to anyone that can help me out with this.

1 Answer 1

0

The better way to do this is using javascript/jquery.

Use either javascript webstorage api or jquery ajax $.post.

Webstorage api will be good for this.

Here how you can do it.

$('body').on('click', '.button.small', function(){
    var index = $(this).parents('table').index('table');
    var cur_workshop = $(this).parents('.innercontent').find('h3').eq(index).text();
    localStorage.setItem('workshop', cur_workshop);
});

Place above script on http://yft.ac/upcoming-workshops/ this page template.

Then call the below script on http://yft.ac/contact-us/ this page template, to get the current workshop name.

localStorage.getItem('workshop');
3
  • Rahil, thank you so much for taking the time to help me on this. So I have added the JavaScript you've written above, but what confuses me is where the information is actually going? I have added a field on the yft.ac/contact-us with an ID of #workshop so could we pass that information automatically into that field? Sep 2, 2013 at 17:06
  • In contact us place this where you want to display the workshop title. $('#wrapper h1').text( localStorage.getItem('workshop') ); make sure you have the following elements in your DOM (#wrapper h1) Sep 3, 2013 at 7:02
  • change the selector to suit yours. make sure ('#workshop') is in DOM Sep 3, 2013 at 7:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.