According to http://api.drupal.org/api/file/developer/topics/forms_api_reference.html the submit type does not have a #description property.

On the poll.module poll_form function

$form['choice_wrapper']['poll_more'] = array(
    '#type' => 'submit',
    '#value' => t('More choices'),
    '#description' => t("If the amount of boxes above isn't enough, click here to add more choices."),
    '#weight' => 1,
    '#submit' => array('poll_more_choices_submit'), // If no javascript action.
    '#ahah' => array(
      'path' => 'poll/js',
      'wrapper' => 'poll-choices',
      'method' => 'replace',
      'effect' => 'fade',
    ),
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gagarine’s picture

Version: 6.15 » 7.0-alpha2

The problem is still present in D7
http://api.drupal.org/api/drupal/developer--topics--forms_api_reference....

// We name our button 'poll_more' to avoid conflicts with other modules using
  // AJAX-enabled buttons with the id 'more'.
  $form['choice_wrapper']['poll_more'] = array(
    '#type' => 'submit',
    '#value' => t('More choices'),
    '#description' => t("If the amount of boxes above isn't enough, click here to add more choices."),
    '#weight' => 1,
    '#limit_validation_errors' => array(array('choice')),
    '#submit' => array('poll_more_choices_submit'),
    '#ajax' => array(
      'callback' => 'poll_choice_js',
      'wrapper' => 'poll-choices',
      'method' => 'replace',
      'effect' => 'fade',
    ),
AaronBauman’s picture

Version: 7.0-alpha2 » 7.x-dev
sun’s picture

Status: Active » Needs review
FileSize
875 bytes

As discussed in aforementioned issue.

Dries’s picture

If we rename the button to 'Add more choices', the title attribute seems 100% redundant.

sun’s picture

Title: The poll_form use a #description for a submit element » poll form uses #description for a button
Issue tags: +Needs usability review

Makes sense, too. Interestingly though, with JS enabled, only a single option is added (-> plural?). Without JS, 5 new options are added.

amateescu’s picture

Version: 7.x-dev » 8.x-dev
Status: Needs review » Reviewed & tested by the community
Issue tags: +Needs backport to D7

As we are past string freeze now, I think the patch from #3 is good enough for D7 and D8, and we can revisit this after #1266336: Modernize Poll module.

amateescu’s picture

Here's some before/after screenshots.

Before, the help text (description) is not displayed anywhere inside the page. After, the help text is displayed when hovering the "More choices" button.

Bojhan’s picture

Status: Reviewed & tested by the community » Needs review

Cannot believe how weird this fix is. The button should just say, "Add choice" and then you would not need the title text. It's a bit confusing in the non-js version it will add 5, but optimizing the text for that seems a bit weird.

Bojhan’s picture

Status: Needs review » Needs work
amateescu’s picture

Status: Needs work » Needs review
Issue tags: +String freeze
FileSize
24.51 KB
1.32 KB

So, after some conversations in IRC with chx and Bojhan, here's another patch that brings the UX for this form in line with core's Field UX. That means adding only one more choice (instead of 5) for non-js users and changing the button text to 'Add another choice'.

'After' screenshot was taken with JS disabled.

Status: Needs review » Needs work

The last submitted patch, 706894-poll_form_button_title-10.patch, failed testing.

amateescu’s picture

Status: Needs work » Needs review
FileSize
3.13 KB

Of course, forgot about the tests..

Status: Needs review » Needs work

The last submitted patch, 706894-poll_form_button_title-12.patch, failed testing.

amateescu’s picture

Status: Needs work » Needs review
FileSize
3.56 KB

This one should be a winner :)

amateescu’s picture

@webchick didn't like this string change for D7 because of Angry french people, so I'm re-rolling the patch from #3 to avoid any confusion.

The attached patch should be reviewed for D7, and the one from #14 for D8. Also added the Novice tag for.. well, novice patch reviewers :)

nmudgal’s picture

rickmanelius’s picture

Confirm that #14 works in drupal 8. I created a node, made 4 options, and then tested on the active node page.

rickmanelius’s picture

#15 works in terms of removing the description... and as long as the string freeze still applies, "More Choices" will have to be left alone.

rickmanelius’s picture

Status: Needs review » Reviewed & tested by the community

Unless there are any objections, this works for both D7 and D8.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

I like this small code clean up and UX improvement for Drupal 8.

I committed #15 to 7.x and #14 to 8.x. Thanks.

Status: Fixed » Closed (fixed)
Issue tags: -Needs usability review, -Novice, -Needs backport to D7

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