Hi, (excuse the lengthy post)
Testing the webform module to have users edit data on a site I have two questions using this module:
First: after a successful submit of the form it displays a link to return to the form 'Go back to the form', using this code (line 1192 etc.)

/**
 * Themable function for webform submission confirmation
 */
function theme_webform_confirmation($node) {
  $node->body = check_markup($node->confirmation, $node->format, FALSE);
  $node->links[] = l(t('Go back to the form'), 'node/'.$node->nid);
  return theme('node', $node, FALSE, TRUE);
}

On returning to the form the data is gone which is annoying if you have prepopulated the 'Default value' or the 'Description' through one of the available variables passed by the URL.
Example Description: Mybeautifuldescription is this: %get[mykey]
gives "Mybeautifuldescription is this:howbeautiful". On return this gives "Mybeautifuldescription is this:blanc"
Also, if the user only had to fill out the form once this doesnt make sense either.
Wat would it take to have it display an (could be additional) link to return the user to the page that called the form in the first place?

Second:The overview at www.example.com/?q=admin/webform lets me export the collected data to a csv file, works fine. My question is: is there an easy way to transfer the data to a content node? The reason being that the data from the webform should UPDATE the data in a node. Is it by design that the admin can't edit the data from the submitted form? (hey, thats a 3rd question)

For the best part of the day I have read about everything about webforms and haven't found an answer to this. Any help is appreciated.

Comments

fangius’s picture

I want to pass a URL example.com/correction?mykey=whatever to have the webform pre-populate a textfield with the value 'whatever'. The textfield with a 'Default value' of %key[mykey] gets pre-populated with 'whatever' as per the docs of Webform.

This works if I type in the URL in the browser. However, if I try to construct the URL through a link it gets messed up and displays as example.com/?q=correction%3Fmykey%3Dwhatever
I'm building the links like this:
$links[] = l(t('mytext'), "correction?mykey=whatever");

Anybody an idea how to solve this?

About my previous question on going back to the calling form, I have found that you can pre-populate a (hidden) field with the value '%server[HTTP_REFERER]', which is the calling form. Only a partial solution of my problem however, since I would also have to pass this value to the success page.

fangius’s picture

$links[] = l(t('mytext'), 'correction', $attributes = array(), $query = 'mykey1=what&mykey2=ever');

and guess what? it passes the data...

fangius’s picture

aha, instead of a confirmation message I can also have an absolute path to a redirect page [yes, it was too obvious]
and if I choose Input format= php code and pass the calling form, I'm done
good thinking, fangius!
now, go to work...

vthirteen’s picture

fangius, what about your second question? is there an easy way to transfer the data to a content node?
did you figure it out?
thank you

fangius’s picture

Sorry, haven't found a solution. However, I'm looking in an other direction: create content: CCK moderation and fields.
But alas, still no joy...

aryam8’s picture

Hi Fangius,
I'm also interested to know if you've found a solution for this.
Let us know!
Cheers,
MP