I have searched high and low but I could not find the answer, I might have used the wrong keywords. Anyway, if someone already has the solution to this, please be sweet and point me to the right direction, I really appreciate that.
What I'm trying to achieve is this:
I'm using Page to display some product information, at the bottom of the page, there will be a form button that says "Request for quote", when user clicks on it, he will be directed to a form (I can use Webform), one of the fields would be pre-filled with the name of the product, which was the title of the node where he came from. The user fills up other fields, and hit the submit, and that's all.
The question is: how do I make the passing of the node title to the form?
Comments
One method but perhaps not the best
One way to accomplish this is passing the value through the URL. First, set the default value for the product field to '%get[product]' with 'product' being the name of the parameter. Then, access the page with a URL that looks like 'http://example.com/node/18?product=product_name'. Where 'product' is the parameter name and 'product_name' is the desired value of the form field.
The button could be a link generated with PHP such as 'node/18?product=' . $title
Two potential complications: I used this with a select field, so I'm not positive that it would work with a regular text field. And secondly, you'd probably need to somehow modify the title field by placing underscores in for spaces or some such.
I imagine there's a way to send the data through post instead of get, but I haven't investigated it personally.
------------------------------
http://fraggles.artsci.wustl.edu (Drupal user documentation and development blog)
THANKS HEAPS!
Hey man! Thanks for the help! The %get[name] was I needed as I had no idea at all how to make the form retrieve the parameter. In fact, with that, I managed to figure out I could use %post[name] too, and I created a small form on the node page that passes more than just product name by using hidden field. Now it works like a charm! Thanks again! You are good man!
Awesome!
That's fantastic! And - thanks for the post tip. That may come in handy *grin
------------------------------
http://fraggles.artsci.wustl.edu (Drupal user documentation and development blog)
Awesome!
That's fantastic! And - thanks for the post tip. That may come in handy *grin
------------------------------
http://fraggles.artsci.wustl.edu (Drupal user documentation and development blog)
Awesome!
Strangely - this post did not immediately display after I submitted it. I attempted to submit it two more times still without seeing it post. Apparently there is a caching problem...?
------------------------------
http://fraggles.artsci.wustl.edu (Drupal user documentation and development blog)
nice
nice, this works like a charm :)
(see http://www.toppop.nl/yeah/shop)
it would be nice to show or hide a part of the form when selecting an option.
like when you select a tshirt, then you would show the extra options for size and color :)
Http://www.reloadmedia.com
Http://www.reloadmedia.com
Thanks! But...
Thanks... this was really useful.
My question would be - how do you do this with checkbox's as they have multiple values! Any ideas?
Thanks!
Adam
I worked out that you do it
I worked out that you do it in exactly the same way as the others only seperate the different values with commas! :) Thanks anyway!
Does this technique work without clean URLs?
I am hosting on GoDaddy so haven't been able to implement clean URLs. My URLs look like this:
http://www.mysite.com/?q=content/pagename
Adding "?key=value" to the end results in a page not found error. I ran into this trying to link to a page with QuickTabs where I needed to pass a parameter to go directly to a specific tab. That feature doesn't work unless Clean URLs is enabled. Is it the same case here?
**Update**
Got Clean URLs working and so this works. Funny thing about the Drupal site - it's all there if you know how to search for it :) What an awesome community.
Passing values for multiple fields
Couldn't find an answer when I was searching but with a little experimentation, figured out that you can send multiple field values by separating them using an ampersand "&". For example:
http://www.mysite.com/pagename?color=colorValue&hue=hueValue&volume=volu...
...will pass a value of colorValue to the field that has the token %get[color], etc.
useful
This helps. added a hidden field meeting_id with a value "%request[meeting_id]%post[meeting_id]", I can then pass this value as a get when I go to the form and then keep it when I submit the form.
e.g. http://mysite.com/testreg?meeting_id=101
and theres more
I have used this:
Inside a hook_form_alter, and loaded views into the form from a cck, and then set custom labels for a given meeting_id, so that I can use webform as a template and then overlay specific meeting information for various meetings over the top of the webform output, funky...a kinda poor mans webform node reference?
S:)
Passing data by using post
Hello SangersDrupalDude,
I have created menu which is given to the asp.net page.
Now i want to pass the data from drupal to that page.
I am able to pass the data by using queryString.But its has imp data, now i want to pass the data by using post method...
SO please help me to pass the data by using POST method.
Wht code should i write to complete this task...
module?
I made a module with a webform-formid-alter and loaded a view programatically to provide data to my webform from a differrent content type
Subscribing - this is very
Subscribing - this is very useful.
Could this be used when chaining multiple forms together to link the 2 and copy a couple of fields to the new form?
Thanks, Joe