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',
),
Comment | File | Size | Author |
---|---|---|---|
#15 | 706894-poll_form_button_title-D7.patch | 703 bytes | amateescu |
#14 | 706894-poll_form_button_title-14.patch | 3.56 KB | amateescu |
#12 | 706894-poll_form_button_title-12.patch | 3.13 KB | amateescu |
#10 | 706894-poll_form_button_title-10.patch | 1.32 KB | amateescu |
#10 | create_poll-after2.png | 24.51 KB | amateescu |
Comments
Comment #1
gagarine CreditAttribution: gagarine commentedThe problem is still present in D7
http://api.drupal.org/api/drupal/developer--topics--forms_api_reference....
Comment #2
AaronBaumanrelated: #345356: #description on button and submit form elements
Comment #3
sunAs discussed in aforementioned issue.
Comment #4
Dries CreditAttribution: Dries commentedIf we rename the button to 'Add more choices', the title attribute seems 100% redundant.
Comment #5
sunMakes sense, too. Interestingly though, with JS enabled, only a single option is added (-> plural?). Without JS, 5 new options are added.
Comment #6
amateescu CreditAttribution: amateescu commentedAs 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.
Comment #7
amateescu CreditAttribution: amateescu commentedHere'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.
Comment #8
Bojhan CreditAttribution: Bojhan commentedCannot 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.
Comment #9
Bojhan CreditAttribution: Bojhan commentedComment #10
amateescu CreditAttribution: amateescu commentedSo, 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.
Comment #12
amateescu CreditAttribution: amateescu commentedOf course, forgot about the tests..
Comment #14
amateescu CreditAttribution: amateescu commentedThis one should be a winner :)
Comment #15
amateescu CreditAttribution: amateescu commented@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 :)
Comment #16
nmudgal CreditAttribution: nmudgal commented#14: 706894-poll_form_button_title-14.patch queued for re-testing.
Comment #17
rickmanelius CreditAttribution: rickmanelius commentedConfirm that #14 works in drupal 8. I created a node, made 4 options, and then tested on the active node page.
Comment #18
rickmanelius CreditAttribution: rickmanelius commented#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.
Comment #19
rickmanelius CreditAttribution: rickmanelius commentedUnless there are any objections, this works for both D7 and D8.
Comment #20
Dries CreditAttribution: Dries commentedI like this small code clean up and UX improvement for Drupal 8.
I committed #15 to 7.x and #14 to 8.x. Thanks.