I am using Webform Conditional Actions module, created my webform exactly how I wanted using the module. When I view the webform within the webform's page the conditionals work great and hide the fields that are supposed to be hidden. But, I am also using UberCart Webform Checkout Pane module which allows me to add a created webform on my drupal site to the checkout form, so a customer has to fill out the form when checking out. The conditional actions are not carrying over in the checkout form. It shows all of the fields, they are not hidden. Has anyone else experienced this? do conditional actions not carry over to the webform checkout pane module? I assumed they would because they are part of the webform and alls the UberCart checkout pane module is doing is allowing me to include an already created webform to my product's checkout form.
Comments
Comment #1
HunterT CreditAttribution: HunterT commentedComment #2
tedbowHunterT
can you provide a link to "Webform Conditional Actions module"?
Comment #3
HunterT CreditAttribution: HunterT commentedWell I am using 4 modules
UberCart and UberCart Webform Checkout Panes http://drupal.org/project/uc_webform_pane
Webform and Webform Conditional (which is your module) http://drupal.org/project/webform_conditional
Now your Webform Conditional module helps me create a webform exactly the way I want it. It looks like this:
What sport will you be using this for?
----(dropdown list of different sports: Football, Hockey, Golf etc...)
Where did you here about us?
----(dropdown list of different references: Website, Phone, Sales Rep, Service Center etc...)
Please let us know which sales rep informed you:
----(long dropdown list with many sales rep names)
Please let us know which service center you visted:
----(long dropdown list with many server center names)
With your module I was able to make it so "Please let us know which sales rep informed you" and "Please let us know which service center you visted" are hidden and only appear depending on which one is selected within "Where did you here about us?"
When I view the form from the webforms page (the page under Admistration > Webforms) it works perfectly showing only the first 2 questions on the form. The conditionals work!
Here is the problem:
The Ubercart Webform Checkout Page module simply just lets you take any webform that is created on your site, and add it to the UberCart checkout form so the customer has to fill out the webform (Customer Survey) when they fill out all of their billing info, name address, shipping method etc. This is set by going to UberCart's Configurations Page > Checkout Settings > Checkout Panes - On this page there is a list of all of the fields that appear on the checkout screen so you can select or deselect which ones you want. Because of the "UberCart Webform Checkout Panes Module" my webform named "Customer Survey" appears on this same list so I can just put a check in its box to make it appear during checkout also. But when I test this out by adding something to my shopping cart and proceeding to checkout page I noticed that the webform is there but the conditionals are not working. I see all 4 questions just how they appear at the top of this post. The last 2 are not hidden like they should be.
My only guess is that when "UberCart Webform Checkout Panes Module" pulls the webform into the checkout pane, it isn't pulling the conditional statements with it, or it is reading the conditional code in a bad order.
Sorry I wrote so much, I just don't know how familiar with the modules that I am using. Please let me know if you have any advice for me, a fix, or an alternative solution to my problem. You help is greatly appreciated.
Comment #4
ravipjoshi CreditAttribution: ravipjoshi commentedI too would be interested in seeing this work.
Comment #5
tedbowI have not installed "uc_webform_pane" but I took a look at the code.
I think that main problem is that uc_webform_pane creates the webform components individually it doesn't use drupal_get_form or the form API. I could be wrong. Therefore the hook_form_alter in webform_conditional is never called.
Like I said didn't actually install it. That is just my idea from looking at the code. Right now getting this to work is not a top priority, sorry.
There is another similar module you could try: http://drupal.org/project/uc_webform
I haven't tried this one either though.
Comment #6
ahkiam CreditAttribution: ahkiam commentedI too am interested in this feature when/if it moves up the priority list.
Comment #7
Dubber Dan CreditAttribution: Dubber Dan commentedsubscribing as also interested
Comment #8
quchidru CreditAttribution: quchidru commentedsubscribing - also interested
Comment #9
praddles CreditAttribution: praddles commentedSubscribing too
Comment #10
chinita7 CreditAttribution: chinita7 commentedThe similar issue in webform checkout pane module is here http://drupal.org/node/1064316#comment-5751860
Comment #11
arski CreditAttribution: arski commented@maintainer: I've applied some changes to uc_webform_pane so that it calls the form hooks. However, the issue now seems to be in the different placement of the webform elements inside the big ubercart checkout form - see also http://drupal.org/node/1064316#comment-5269302 - lemme know if I can help any further.
Comment #12
arski CreditAttribution: arski commentedBumping this to a bug report as the issue here are hardcoded paths in this module that others can't do much about. Let me know what your thoughts are on this (see the link in my previous comment for more details from the uc_webform_pane side).
Thanks
Comment #13
tedbow@arski, if I understand the problem, I think a flexible solution would be to let other modules alter the css id that this module uses for elements.
I have attached a patch that creates a new hook - hook_webform_conditional_css_id_alter
This allows your module to change to change the css_id that my module will use for every element.
I have just tested that this patch doesn't break this module. I have not tried to implement the hook. Please let me know if it works for you.
Comment #14
tedbowChanging to 6 dev version, etc
Comment #15
tedbow@arski, actually after thinking about this the current patch it is probably not the best performance wise. I think there should be just one drupal_alter call to for the whole form to change all the ids at once. Otherwise for forms with tons of components the drupal_alter will be called tons of times, whether not they have any modules installed that actually implement it.
Just fyi I am working on a different patch.
Comment #16
tedbowok attached new patch. hook is now hook_webform_conditional_css_ids_alter
So it is just called once to change all css ids.
Please let me know if this works for you. Would you need the $form_state also passed to the hook?
Comment #17
arski CreditAttribution: arski commentedHi, nice one. I think I was able to implement the hook and make your .js work with the different field ids inside the checkout pane.
The whole thing did, however, break the checkout, so I'm not signing off on it just yet, but it looks good. I'll look into the cause of further issues tomorrow. Thanks again.
Comment #18
arski CreditAttribution: arski commentedRight, so mainly this works quite nicely. The JavaScript bit integrates flawlessly for sure.
What I needed to hack around a bit was the after_build function. I pretty much have a solution, though it requires for the ucwp module to have a higher weight than yours (so that I could replace the after_build function). I can do that, but usually it's best to avoid changing the weight..
There is one alternative fix that should be completely harmless. Would you mind adding a check like
if (sizeof($submitted_values)) { ... }
after$submitted_values = _webform_conditional_get_submitted_values($form_state);
around line 210 of webform_conditional.module for the rest of the code in there.Since the values of a webform pane are slightly in a different place, the $submitted_values array in there when used inside a checkout pane is simply empty. On a real webform, if nothing is entered, it will have a list of all the elements, with empty values, but the array itself will never be empty.
This would solve the last remaining issues for the integration!
Cheers
Comment #19
tedbowOk
Ok my question then if "sizeof($submitted_values)" will always be empty in your case doesn't that mean the lines of code that I would be surrounding by the if statement:
Would never be executed if it were in a checkout pane? If so then the required flag will never be reset.
Have you tried making a required competent conditional on another component so that it is hidden by default. Then don't fill out that component and see if you get the required error.
Can you test this out b/c I don't have Ubercart Checkout panes installed?
Thanks
Comment #20
arski CreditAttribution: arski commentedYes, that is what I'm actually aiming for. I've created a similar after_build function inside the UCWP that is able to fetch the $submitted_values and then select the right components to hide, based on whatever conditions were picked or not. See at the very bottom of my last commit http://drupalcode.org/project/uc_webform_pane.git/blobdiff/cd0e6ffeb1ed1...
And yes, your scenario works nicely with the adapted after_build function, even tested it with multi-level conditionals :)
Cheers
Comment #21
tedbowOk I added
if (!empty($submitted_values)) {
Let me know if that works for you.
Comment #22
arski CreditAttribution: arski commentedyeah, works like a charm. Marking as rtbc straight away I guess.
Do you plan to apply similar patches to the D7 branch as well?
Thanks for the updates!
Comment #23
tedbowYes I plan to make the changes to D7 branch also. Might not get to it till after the weekend though
Comment #24
chinita7 CreditAttribution: chinita7 commented#21 works with the latest uc_webform_pane 6.x-3.x-dev as expected on my site. Thanks!
Comment #25
tedbowCommitted to dev
Comment #26
tedbowI have attached a patch for Drupal 7.
@arski and others please test and report back. I will commit it when I here back
Thanks
Comment #27
arski CreditAttribution: arski commentedHmm, doesn't seem to be quite working. When I do
alert(triggerField_info.toSource());
after$.each(Drupal.settings.webform_conditional.fields, function(triggerField_key, triggerField_info) {
in the .js file, the css_id values in the returned object are still the unchanged ones.The
webform_conditional_css_ids_alter
function is being called for sure, and values are being adjusted in it.Comment #28
arski CreditAttribution: arski commentedany news on this? :)
Comment #29
densolis CreditAttribution: densolis commentedAll,
I am helping Ted with this module and will be talking with him tomorrow (8-30-12). I will bring this to his attention. Either Ted or I will follow up.
Dennis
Comment #30
arski CreditAttribution: arski commentedHey again, did you not have a productive talk or what's happening here? :D
Comment #31
densolis CreditAttribution: densolis commentedarski,
I talked to Tedbow just a hour ago. He will look into this and see if he can get it resolved. He did look at the code while I was talking to him and stated it was not a simple fix. He will have to spend a little time on it, but he is working on it.
I'm sorry I don't have a more definitive answer for you.
Dennis
Comment #32
arski CreditAttribution: arski commentedwell this is definitive enough, meaning there is some progress :)
Comment #33
arski CreditAttribution: arski commentedbump :)
Comment #34
debo7debo CreditAttribution: debo7debo commentedany fix yet? I'm working on the second site that I need this to work and I was hoping there would be a solution by now.
Comment #35
tedbowSorry I has been along time since I have looked this issue.
It seems like it works with "UberCart checkout panes" for 6.x but the patch about for 7.x still needs work.
Does that seem right?
Comment #36
debo7debo CreditAttribution: debo7debo commentedYes 6.x was fixed but I didn't try the last 7.x patch since there were already comments that it didn't work completely right. I'll give it a try & update this thread.
Comment #37
debo7debo CreditAttribution: debo7debo commentedNope, that patch does not work. Doesn't even apply right. Did it on 7.x-1.x-dev
Comment #38
tedbowOk thanks for the update
Comment #39
debo7debo CreditAttribution: debo7debo commentedI also tried a few of the devs and patches all differently and none seems to work. I'm surprised more people didn't have a problem with this.
Comment #40
Mike_s CreditAttribution: Mike_s commentednone of the dev are working.
Comment #41
ghubika CreditAttribution: ghubika as a volunteer commentedAny news on this thread? :> I would need this function badly. The conditional module is included in webform now, does that simplify or make the issue more complex?