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

<?php
$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',
    ),
?>
Files: 
CommentFileSizeAuthor
#15 706894-poll_form_button_title-D7.patch703 bytesamateescu
#14 706894-poll_form_button_title-14.patch3.56 KBamateescu
PASSED: [[SimpleTest]]: [MySQL] 33,169 pass(es).
[ View ]
#12 706894-poll_form_button_title-12.patch3.13 KBamateescu
FAILED: [[SimpleTest]]: [MySQL] 32,800 pass(es), 126 fail(s), and 8 exception(es).
[ View ]
#10 706894-poll_form_button_title-10.patch1.32 KBamateescu
FAILED: [[SimpleTest]]: [MySQL] 32,681 pass(es), 240 fail(s), and 18 exception(es).
[ View ]
#10 create_poll-after2.png24.51 KBamateescu
#7 create_poll-before.png39.96 KBamateescu
#7 create_poll-after.png46.19 KBamateescu
#3 drupal.poll-form-button-title.3.patch875 bytessun
PASSED: [[SimpleTest]]: [MySQL] 22,122 pass(es).
[ View ]

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....

<?php
// 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
StatusFileSize
new875 bytes
PASSED: [[SimpleTest]]: [MySQL] 22,122 pass(es).
[ View ]

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

StatusFileSize
new46.19 KB
new39.96 KB

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
StatusFileSize
new24.51 KB
new1.32 KB
FAILED: [[SimpleTest]]: [MySQL] 32,681 pass(es), 240 fail(s), and 18 exception(es).
[ View ]

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
StatusFileSize
new3.13 KB
FAILED: [[SimpleTest]]: [MySQL] 32,800 pass(es), 126 fail(s), and 8 exception(es).
[ View ]

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
StatusFileSize
new3.56 KB
PASSED: [[SimpleTest]]: [MySQL] 33,169 pass(es).
[ View ]

This one should be a winner :)

amateescu’s picture

Issue tags:-string freeze+Novice
StatusFileSize
new703 bytes

@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.