Community & Support

Catching request arguments in drupal / Webforms

Hi.

Sorry if this is the wrong forum - took a guess.

I'm using webforms and I'd like to link to the same form and by doing so setting some form values (a few image links that will put some parameters on the request and put them in hidden fields...). I have a few quite dumb strategies to accomplish this (as in x different forms and using default value, javascripting out the parameters and manipulating the DOM and such), but I think they smell a little. I reckon that's by way of ignorance.

So I was hoping for some pointers or a brief sketch how to do this. Further I was hoping to mimic the views module so I can just link like this: .../mywebform/param1/param2

Comments

Sorry again

Just as I gave up and posted this I stumbled over the fact that this is supported out of the box with the webforms module. Kudos to the Webforms team!

For any other near-blind individuals out there I'll just describe the simple solution.

First add hidden fields to the form, ie param1, param2. Then set default value to %get[param1] for the param1 field. (no cigar for guessing param2).

Then link to it this way:

<a href="./mywebform?param1=param1value">

arg()

Too bad the form won't work with arg(x), that way my URLs would be cleaner.

I currently have site.com/node/97/?nid=56 but it would be nicer to have site.com/node/97/56 and just get the '56' value with arg(1). Is that possible?

Drupal is like falling in love with a girl after you got to know her, instead of instantly falling in love with her appearance... :)

webform to view

You could pass an argument to a view(views2) that has the data ,from a webform(webform module).

Send the parameter from the webform in 'Additional Processing: ' section:
formfield_1, formfield_2 are webform fields.

Additional Processing:

global $param1;
$param1 = $_POST['submitted']['formfield_1'];
global $param2;
$param2 = $_POST['submitted']['formfield_2'];
$node->webform['confirmation'] = 'internal:yourviewname/'.$param1.'/'.$param2;

simplify

nobody click here