This is the module that I am using to help me create my webform. http://drupal.org/project/webform_conditional

It pretty much makes it so for the field "Where did you hear about us?:
if they selected Sales Rep a new field pops up sayins which Sales Rep informed you about us? (dropdown list of all sales rep names)
if they selected Service Center a new field pops up sayins which Service Center did you visit? (dropdown list of all service centers)

In total my webform is 3 fields, but only one of them shows in the beginning which is "Where did you hear about us?" The others appear depending on whether they are selected or not in "Where did you hear about us?".

When I view this webform under Administration > Webforms the conditionals work perfectly and last 2 fields are hidden.

After using "UberCart Webform Checkout Panes Module" to add my webform to the checkout pane, it adds it and lets me select the weight and everything, but it isn't carrying over my conditionals. I see all 3 fields of the form displayed.

Could someone please tell me why this may be happening and if there is a possible fix for it? My assumptions are that "Webform Conditional" is an extra module for webform, so the checkout panes module doesn't account for it when it carries the form over to the checkout pane. Or it isn't reading the code from the conditionals at the proper time?

Comments

arski’s picture

Title: Does anyone know why the UberCart Weborm Checkout Panes Module isn't including my webform's conditionals? » Add Webform Conditional support
Version: 6.x-3.2 » 6.x-3.x-dev
Category: task » feature

Hey,

Well yes, quite obviously Webform Conditional is an extra module that I haven't heard of yet and hence this module won't necessarily support it straight away. I'll look into it when I have some time to see how complicated a fix would be. Will let you know how it goes.

Cheers

HunterT’s picture

Thanks a lot

tedbow’s picture

@arski,
Hi I am the creator of Webform Conditional. I think this would be a complicated fix. Your module creates the webform components individually and doesn't use drupal_get_form, correct? I am using hook_form_alter to make my changes.

I haven't actually installed your module, just looked at the code a little bit so sorry if my question misses the point of your module. Why isn't the module creating the webform the same way the Webform module does. Like this:

// Render the form and generate the output.
  $form = !empty($node->webform['components']) ? drupal_get_form('webform_client_form_' . $node->nid, $node, $submission, $is_draft) : '';

I think my module would work in this case but like I said I don't much about your module.

Thanks,
Ted

arski’s picture

hmm, good pointer.. to be honest I didn't have any time at all to integrate webform_conditional yet. But you're right, there's probably no reason why this module shouldn't be calling drupal_get_form on the webform_client_form_$node->nid (what it's doing now is directly calling webform_client_form which is functionally the same as it's the callback for all webform_client_form_$node->nid forms, but avoiding the drupal form hooks obviously).

I'll look into it and see if I can switch the code to use drupal_get_form. I must admit the module was not mine originally and I suppose I never took the time to check every little bit of the old working code to make sure it's "nice" ;)

Cheers,
Martin

arski’s picture

Hey again,

just a small update - I basically know how this can be achieved as I've done something similar in http://drupal.org/project/uc_cck_pane, however, this is a very big change and I don't really have that much time for it now. (In short, I can't use drupal_get_form as that returns a fully rendered form as a html string, while I need an array that I can insert in the big checkout form - that's just how UC checkout form works.)

I've rolled out another stable 6.x release now and the plan is to have this implemented for the next release, but I can't promise anything time-wise at this stage. It would possibly help if more people were interested in this, and of course if you can step in with some coding work, then that would be more than welcome too.

Cheers

linksync’s picture

subscribing - this would be great enhancement to an already great module.

rikki_iki’s picture

subscribing.

mattcasey’s picture

subscribing

benjohnstone’s picture

+1

WebmistressM’s picture

StatusFileSize
new52.96 KB
new152.55 KB

I too am looking for a bit more control in regards to how you get your webform to appear in the checkout pane. For example, I wish to create a webform that is only relevant to a particular payment method. Simply put, if the customer does not choose to pay by Paypal, than they will have to issue a check. However, it would speed things up immensely if I could include a "pay by check" (SSL secure) webform in the checkout pane.

Getting that form to show up on the checkout pane with this module is no problem. Its just that I cannot have control over including that form inside the payment methods section, specifically under the "Check" option.

arski’s picture

Hi,

your request is only very remotely related to the op who asked for support for a particular existing module. Please do not post things in an issue just because the topics are slightly similar. What you're asking for is plugging one pane inside another, which can only be done using hook_pane_alter on the payment pane and which is definitely outside the scope of this module.

Another solution that might be interesting for you is having the webform pane appear/disappear based on the payment method selection, but as far as I know that can only be done with a page reload or js, and equally both these things are outside of the scope of this module.

Basically your request is general to the management and altering of any UC pane and not webform panes specifically.

WebmistressM’s picture

Honestly, I dont think we always know exactly what we need every time we get to the point that we realize we might need to ask for help, so I may have misplaced this post, yes. It seemed like conditionals is what I am seeking, as my overall desire is to have "whether it displays or not" dependant on whether something else on the checkout pane is clicked.

With the way that Ubercart is almost an entity in itself, I guess that is where the confusion lied. Thanks for getting back to me.

arski’s picture

Hi again,

So I've committed some changes to the module that now generate the webform in a way that calls hook_form_alter implementations.

Unfortunately, since there are a lot of structural differences, the JS code from webform_conditional doesn't quite work out of the box. I think the main issues are the field and form #id's that it expects to get. For example, the fields are no more
webform-component-[FIELDID]
but instead
webform-component-webform-nid[NID]--0--[FIELDID]

Also, there is no more individual form tag for the webform pane, instead, there is one big form for the whole checkout, and the webform is inside a fieldset with id's such as webform_nid[NID]-pane

If you could adjust your code to make things more dynamic that would be great - I don't know though if hook_form_alter has enough information to figure out that the webform is loaded inside a checkout pane though. If not, let me know what kind of fix would be useful.

Cheers

PS. Commit will be in -dev within the next 12 hours as usual.

chinita7’s picture

Are these two modules already compatible as of now ?

arski’s picture

doubtful, please read the previous post for the status. basically awaiting some support from the other module's devs.

chinita7’s picture

The similar issue in webform conditional module is here http://drupal.org/node/1063962

arski’s picture

Status: Active » Postponed

Waiting for something to happen in webform_conditional - can't do much until it does.

tedbow’s picture

@arski attached patch for webform_conditional with possible solution here - http://drupal.org/node/1063962#comment-6036002

Can we keep discussion as it relates to the patch on that issue?

Thanks

arski’s picture

Status: Postponed » Active

OK, I'll check it out. Thanks!

arski’s picture

Looking good at first glance. Conditionals are working. But the webform is not submitting at checkout, so a small glitch still in there somewhere. Should be fixed soon. Short sentences ftw.

arski’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev

OK, update committed to the 6.x branch. Pending a small addition to the patch in #1063962: Conditional actions do not work within UberCart checkout panes module? this should be complete.

Switching to 7.x.

arski’s picture

note to self, D7 patch was just provided in #1063962: Conditional actions do not work within UberCart checkout panes module? - need to test and implement same functionality.

arski’s picture

Status: Active » Postponed

that patch needed work, waiting for a final fix.

debo7debo’s picture

Did anyone find a solution to this yet? I've run into this problem again on my second site needing the conditionals to work in checkout.

arski’s picture

As I mentioned before, the issue is fixed here, but requires an update from Webform Conditionals issue as referenced above.

debo7debo’s picture

@arski - oh sorry. I have 7.x-3.9 installed, the fix was committed to that version or dev?

arski’s picture

There is a fix for this module in dev, but it won't work until #1063962: Conditional actions do not work within UberCart checkout panes module? (Webform conditional module itself) is fixed too - that's what I meant.

debo7debo’s picture

Ok I see. You think I should download dev in the mean time or just stick with the stable release?