https://bugzilla.wikimedia.org/show_bug.cgi?id=22003
Summary: Mandatory Radiobutton fields always fail validation
Product: MediaWiki extensions
Version: any
Platform: All
URL: http://wiki.montcopa.org/TestWiki/index.php?title=Active
_Part-10004&action=formedit
OS/Version: All
Status: NEW
Severity: major
Priority: Normal
Component: SemanticForms
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Created an attachment (id=6921)
--> (https://bugzilla.wikimedia.org/attachment.cgi?id=6921)
Patch adds ID to radiobutton field for use with validation
If you set a mandatory tag for a radiobutton field in version 1.8.6, will
always fail javascript validation returning "cannot be blank".
I don't know why this worked in versions prior to 1.8.6, but stopped working
there.
If you do not have the tag "mandatory" in a field definition, will also allow
selection "none". If you add the mandatory validation, will never validate.
Patch attached that will fix this problem.
Example:
{{{field|Client Status|input type=radiobutton|property=Client
Status|default=Pending|mandatory}}}
-- Property Definition --
Property:Client Status
This is a property of type [[Has type::String]]. It links to pages that use the
form [[Has default form::Active Participants List]].
The allowed values for this property are:
* [[Allows value::Pending]]
* [[Allows value::Active]]
* [[Allows value::Inactive]]
* [[Allows value::Rejected]]
-- HTML Generated in broken version --
<span class="mandatoryFieldsSpan">
<input type="radio" tabindex="2" name="Active_Participants_List[Client
Status]" value="Pending" /> Pending
<input type="radio" tabindex="2" name="Active_Participants_List[Client
Status]" value="Active" checked="checked" /> Active
<input type="radio" tabindex="2" name="Active_Participants_List[Client
Status]" value="Inactive" /> Inactive
<input type="radio" tabindex="2" name="Active_Participants_List[Client
Status]" value="Rejected" /> Rejected
</span>
<span id="info_2" class="errorMessage"></span>
-- Javascript validation generated --
if (! validate_mandatory_checkboxes('input_2', 'info_2')) num_errors += 1;
In validate_mandatory_checkboxes, field "input_2" will never be found, so will
return validation error.
-- Proposed fix will generate following HTML --
</th><td colspan="5"> <span class="mandatoryFieldsSpan">
<input type="radio" id="input_2" tabindex="2"
name="Active_Participants_List[Client Status]" value="Pending" /> Pending
<input type="radio" id="input_2" tabindex="2"
name="Active_Participants_List[Client Status]" value="Active" checked="checked"
/> Active
<input type="radio" id="input_2" tabindex="2"
name="Active_Participants_List[Client Status]" value="Inactive" /> Inactive
<input type="radio" id="input_2" tabindex="2"
name="Active_Participants_List[Client Status]" value="Rejected" /> Rejected
</span> <span id="info_2" class="errorMessage"></span>
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l