This is probably still relevant in Webform 4-dev.

Webform UI should check if a "pre-build options list" is selected, and if it is, load that list. Currently it only listens for onchange. My custom mod sets the default "pre-build options list" via #default_value, but that doesn't do anything: the Options textarea remains empty. I have to trigger the onchange in a custom JS.

Webform could check if the "pre-build options list" element has a value selected and if so load that value.

It's an edge case, I admit, but it's free.

CommentFileSizeAuthor
#4 webform-2098485-4.patch604 bytesrudiedirkx
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Meliorate’s picture

Category: feature » bug
rudiedirkx’s picture

Priority: Minor » Normal

I don't think that's what I meant... Yours sounds like a bug. Mine is definitely not a bug and very probably an edge case.

If yours is a bug, create a new issue and please remove the text from comment # 1.

DanChadwick’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

7.x-3.x is only receiving critical bug fixes. If this is still an issue in 7.x-4.x, please reopen and provide more detail and/or a patch.

rudiedirkx’s picture

Version: 7.x-3.18 » 7.x-4.x-dev
Status: Closed (won't fix) » Needs review
FileSize
604 bytes

You waited a year, to close it. Nice.

If you don't understand the problem, don't attach the patch and do this somewhere:

<?php
function YOURMOD_form_webform_component_edit_form_alter(&$form, &$form_state) {
  $form['extra']['options_source']['#default_value'] = 'days';
}
?>

The Load a pre-built option list option will be selected, but the option list wasn't downloaded and pre-filled. Attached patch does that by always triggering the change event, which now also checks for None.

DanChadwick’s picture

The first time I saw your issue was 7 hours ago ... as I spent my weekend weeding through 350 old, moldy, largely-abandoned issues. Care to help with some of them? I could sure use it.

rudiedirkx’s picture

Just a few, if you don't mind =)

You can trust me and apply this patch without testing decently. That'll save a few minutes.

I'll browse the issue q, always exciting. Where do I start? The 3.x stuff?

DanChadwick’s picture

Start anywhere that interests you. Most 7.x-4.x issues have some validity and/or need some real work. Most 7.x-3.x issues can be closed. Some are duplicates or need linking to related issues.

Unless you want to be a maintainer, please close 7.x-3.x issues that don't relate to 7.x-4.x or 8.x. I don't have the time to commit them, and I won't commit them blindly. I you want to be a maintainer for 7.x-3.x, I totally support the idea.

rudiedirkx’s picture

I don't want to be a maintainer. I will look into old 3.x issues (and leave the more relevant, current 4.x issues to you). The patch in #4 still needs your attention though. It's still 'broken' in 4.x.

DanChadwick’s picture

Thank you for your efforts. When this issue bubbles up to the top of the queue (which it will by virtue of the activity) I will look at it. I haven't looked at all at the jQuery for select components, but on the surface, your patch seems logical.

Webform is huge. It is hard to be familiar with all aspects of it. :(

DanChadwick’s picture

I'm confused as to why your custom module doesn't both set #default value and the options list, rather than relying on JS to do it. Wouldn't that be cleaner? And it would work in the absence of JS.

DanChadwick’s picture

Status: Needs review » Needs work
rudiedirkx’s picture

Status: Needs work » Closed (won't fix)

Because way back when, there wasn't a clean way to get the options in custom code. In 4.x there is:

<?php
$component['extra']['options_source'] = 'days';
$form['extra']['items']['#default_value'] = _webform_select_options_to_text(_webform_select_options($component, TRUE, FALSE));
?>

so it's all good!

It looks like there's a bug in the ajax part though... If I can reproduce, I'll create a new issue.

rudiedirkx’s picture

Even simpler:

<?php
$form['extra']['items']['#default_value'] = _webform_select_options_to_text(_webform_select_options_callback('days', array()));
?>
DanChadwick’s picture

Excellent! Thanks for your work on this.