Last modified: 2010-01-08 17:59:04 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T24003, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 22003 - Mandatory Radiobutton fields always fail validation
Mandatory Radiobutton fields always fail validation
Status: RESOLVED INVALID
Product: MediaWiki extensions
Classification: Unclassified
SemanticForms (Other open bugs)
unspecified
All All
: Normal major (vote)
: ---
Assigned To: Yaron Koren
http://wiki.montcopa.org/TestWiki/ind...
:
: 22013 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-01-03 16:25 UTC by Jack D. Pond
Modified: 2010-01-08 17:59 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch adds ID to radiobutton field for use with validation (790 bytes, patch)
2010-01-03 16:25 UTC, Jack D. Pond
Details

Description Jack D. Pond 2010-01-03 16:25:25 UTC
Created attachment 6921 [details]
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>
Comment 1 Yaron Koren 2010-01-08 00:06:18 UTC
*** Bug 22013 has been marked as a duplicate of this bug. ***
Comment 2 Yaron Koren 2010-01-08 17:59:04 UTC
This was actually a somewhat different bug, but it's been fixed in version 1.8.7.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links