0
votes

I am including a webform that a user will fill out on a job listing page if they are interested in the job. The job listing page itself is created from a custom module as the result of a job search and I am including the webform like so:

render(node_view(node_load(363), 'full', NULL));

where 363 is the webform id. So I'm trying to figure out how I can pass at least the job number into the webform. I know I can edit the webform to include a hidden field where I can get values from the URL like %get[key] but I am using clean URL's so I do not have a specific key in the URL like www.example.com/jobs?job_number=1234 where I can grab "job_number". My actual URL looks like this: http://www.example.com/job-board/view/41904 so I need to grab 41904 in my webform. How can I accomplish this? Can I use a special token in my webform hidden field or is there a way in my custom module to somehow pass the job number to the webform when I go to display it on the job detail page?

2

2 Answers

0
votes

Ok so I figured this one out. So it looks like right before I call my webform, I can actually set a $_GET parameter and it will pass to the webform. So I did this in my custom module:

// send job_number to webform via $_GET
$_GET['job_number'] = $job_number;
render(node_view(node_load(363), 'full', NULL));

Now in my webform, I added a hidden form field that has %get[job_number] as the default value and this worked.

0
votes

You can get all the arguments by using arg();

try

echo "<pre>";
print_r(arg());
echo "</pre>";

In you case you can get it by echo arg(2);