Here's a tough one for ya!

When going back or forward through a multi-page form, the text that was previously entered in a textarea or textfield gets lost. The rest of the form elements remain changed, and the non-hidden Webform text elements maintain their text as well - it's just the conditional elements that lose it.

Thanks for porting this across to D7, I'm a big fan of the module. Keep up the great work!

CommentFileSizeAuthor
#8 webform_conditional-1196026-8.patch853 bytesplach

Comments

pumpkinkid’s picture

Not sure why, but my problem is that on multi page forms I can select a choice that should trigger the conditional element and I have to go back to another page and back to the same page beofore it shows up...

not trying to hijack the thread, just not sure if they are related...

revnoah’s picture

Eric, I'm having the same problem. Radio buttons are fine but textareas and textfields are not displaying their field data. If I dig into the webform module, I know the value is there but it isn't getting output. I'm curious to how you managed to solve this.

emcniece’s picture

Digging back through my installs of D7, I don't think I ever did solve this. Sorry..

revnoah’s picture

Good to know it isn't just me. I had to hack together a work-around due to a tight timeline but a long-term solution would be preferable.

emcniece’s picture

I would definitely be interested in hearing your solution :D

star-szr’s picture

Title: Text Gets Lots In Multi-Page Form » Text Gets Lost In Multi-Page Form

I wasn't able to fix this, but was able to track down the value getting cleared to _webform_condtional_clear_element_values() which is called only in webform_conditional_element_after_build().

I experimented with changing line 391 in _webform_conditional_was_hidden():

    $this_hidden = (!$matched &&  $components[$cid]['extra']['webform_conditional_operator'] == "=") || ($matched &&  $components[$cid]['extra']['webform_conditional_operator'] == "!=");

Swapping $matched for !$matched seems to fix the bug reported here, and makes logical sense to me, but this breaks the saving of the proper webform values. Hidden components with values are saved in the webform results, whereas visible components are not saved.

In the D6 version of the module, webform_conditional_element_after_build() checks $form_element['#post'] to determine whether the form is being submitted or displayed. In the D7 version $form_state['input'] is checked. I'm not well-versed enough in the differences in the FAPI between 6 and 7 to know whether this is the right approach or not. The multi-page behaviour works fine on the demonstration form which looks to be Drupal 6.

tedbow’s picture

Status: Needs review » Postponed (maintainer needs more info)

Can someone please post a test form to this issue that has this problem? You find instructions here #1123730: Needed: Sample D7 Webform exports. Please post to the form to this issue thread and not the other one.

plach’s picture

Status: Active » Needs review
StatusFileSize
new853 bytes

I have the same problem, it seems it is caused by using the wrong page number: component values are not properly populated and so trigger field values are not correctly interpreted.

tedbow’s picture

@plach thanks for the patch. Does this fix it for you? Can other please try the patch and see if it fixes their issues? I don't have time to try right but hopefully soon.

plach’s picture

Yes, everything looks ok here.

tedbow’s picture

Status: Postponed (maintainer needs more info) » Needs review

@plach, great news. I would still other to try to this patch if they can. Different forms seem to act differently.

Also if someone could post an a test form that gets fixed by this patch, see comment #7, that would be great!

emcniece’s picture

I can confirm the patch in #8

Tested on Webform Conditional 7.x-1.x-dev (datestamp = "1302569109"), Drupal 7.2

Note the old install - I was saving it :) Can't confirm newer versions yet.

Works great.

tedbow’s picture

@plach, thanks I have committed the patch to 7.x-1.x-dev.

tedbow’s picture

Status: Needs review » Fixed
tedbow’s picture

marking as fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

raulmuroc’s picture

Issue summary: View changes

The error persists on dependent selectors. for ex:

Selector 1 (sector): Banking <-- when selected banking it appears a second selector

Selector 2 (sub-sector): accountant <-- this is the value choosen.

Then I go one step forward. After that I come back thorugh the webform's multi-step back button, the selector 1 persists, but he selector 2 has disappeared, as well as its value....