html validation error in simplenews block form
maria_zk - December 2, 2008 - 17:54
| Project: | Simplenews |
| Version: | 5.x-1.5 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | won't fix |
Jump to:
Description
Each element (e-mail, subscribe and unsubscribe radio buttons) are wrapped in the following div .
The validation fails as the id appears three times... Any help on how to theme the form accordingly??

#1
Please provide the faulty and the corrected HTML.
#2
The code for the sidebar block that doesn't validate is the following:
<div id="block-simplenews-newsletter-28" class="block block-simplenews">
<div class="title">MY newsletter</div>
<div class="content"><p></p>
<form action="/" accept-charset="UTF-8" method="post" id="simplenews-block-form-28">
<div><div class="form-item" id="edit-mail-wrapper">
<label for="edit-mail">E-mail: <span class="form-required" title="Necessary field.">*</span></label>
<input type="text" maxlength="128" name="mail" id="edit-mail" size="20" value="" class="form-text required" />
</div>
<div class="form-radios"><div class="form-item" id="edit-action-wrapper">
<label class="option"><input type="radio" name="action" value="subscribe" checked="checked" class="form-radio" /> subscribe </label>
</div>
<div class="form-item" id="edit-action-wrapper">
<label class="option"><input type="radio" name="action" value="unsubscribe" class="form-radio" /> unsubscribe </label>
</div>
</div><input type="submit" name="op" id="edit-submit-2" value="submit" class="form-submit" />
<input type="hidden" name="form_id" id="edit-simplenews-block-form-28" value="simplenews_block_form_28" />
</div></form>
So as you can see, the following div appears twice: and the validation fails because of the id.
It would be corrected if I could change the second div into e.g. , only that I cannot find where to change this form element...
Should I just go ahead and edit the form element in my template.php with theme_form_element? And change the id's to classes?
Also... How can i theme this block?
#3
This is theme specific, not simplenews related. The subscribe block form in Garland:
<form id="simplenews-block-form-8" method="post" accept-charset="UTF-8" action="/sn5/">
<div><div class="form-item">
<label for="edit-mail">E-mail: <span title="This field is required." class="form-required">*</span></label>
<input type="text" class="form-text required" value="" size="20" id="edit-mail" name="mail" maxlength="128"/>
</div>
<div class="form-radios"><div class="form-item">
<label class="option"><input type="radio" class="form-radio" checked="checked" value="subscribe" name="action"/> Subscribe</label>
</div>
<div class="form-item">
<label class="option"><input type="radio" class="form-radio" value="unsubscribe" name="action"/> Unsubscribe</label>
</div>
</div><input type="submit" class="form-submit" value="Submit" id="edit-submit" name="op"/>
<input type="hidden" value="simplenews_block_form_8" id="edit-simplenews-block-form-8" name="form_id"/>
</div></form>
#4
I have the same problem. I tested in Garland, as well, and it still doesn't validate. Here's the output:
<form action="/" accept-charset="UTF-8" method="post" id="simplenews-block-form-47">
<div><div class="form-item" id="edit-mail-wrapper">
<label for="edit-mail">E-mail: <span class="form-required" title="This field is required.">*</span></label>
<input type="text" maxlength="128" name="mail" id="edit-mail" size="20" value="" class="form-text required" />
</div>
<div class="form-radios"><div class="form-item" id="edit-action-wrapper">
<label class="option"><input type="radio" name="action" value="subscribe" checked="checked" class="form-radio" /> Subscribe</label>
</div>
<div class="form-item" id="edit-action-wrapper">
<label class="option"><input type="radio" name="action" value="unsubscribe" class="form-radio" /> Unsubscribe</label>
</div>
</div><input type="submit" name="op" id="edit-submit" value="Submit" class="form-submit" />
<input type="hidden" name="form_id" id="edit-simplenews-block-form-47" value="simplenews_block_form_47" />
</div></form>
#5
See #3
#6
I saw #3, which is why I tested it in Garland and posted the results in my previous comment. It's not a theme issue if Drupal's default themes produce the error.
#7
Your solutions for this error are welcome.
#8
Any progress here ?
I really need this subscribe block to work..
I also see the id : 'edit-action-wrapper' twice
#9
No progress. What needs to be done is in the form definition, to replace the two checkbox items by a checkboxes item with two elements. Form validate and submit functions to be modified accordingly. Anyone care to do this?
#10
Here is the solution, need to patch /includes/form.inc
http://drupal.org/node/367689
Regards,
Mog.
#11
but this solution is for D7 my friend....
i have the same problem,
where is the code where the radios print? is it possible add other div there?...
#12
hi all :)
I fixed it that way:
1.
copy your block.tpl.php to block-simplenews.tpl.php
2.
change
<?php print $block->content; ?>through
<?php$block->content = preg_replace('/edit-action-wrapper/', 'edit-action-wrapper-2', $block->content, 2);
$block->content = preg_replace('/edit-action-wrapper-2/', 'edit-action-wrapper-1', $block->content, 1);
print $block->content;
?>
(i'm not an coding expert - but it works fine for me, as long as there are only 2 options.
And by using the block-simplenews.tpl.php file it's not gone when you update your drupal and/or modules.)
#13
Ok, sorry,
this solutions is OK
mogtofu - http://drupal.org/node/367689
greetings
#14
Unless someone provides a patch, I will not fix this. With no help for Simplenews support and D7 coming up, I do not work on D5 anymore.