Opened 8 years ago

Closed 4 years ago

#12227 closed defect (patchwelcome)

dojo.fieldToObject Not Working for Radio Button Group

Reported by: Fergus Hadley Owned by: Eugene Lazutkin
Priority: high Milestone: 1.13
Component: HTML Version: 1.5
Keywords: fieldToObject, form, radio Cc:
Blocked By: Blocking:

Description

dojo.fieldToObject seems to have a problem with radios. In the following example, the value of the radio button group is returned as NULL no matter what is selected.

Works fine for me with all other form inputs.

I couldn't find a test page for this function so have made a test case below:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Form to Object test</title>
<script
	src="http://ajax.googleapis.com/ajax/libs/dojo/1.5.0/dojo/dojo.xd.js.uncompressed.js"
	djConfig="parseOnLoad: true" 
	language="javascript" type="text/javascript"></script>
<script type="text/javascript">
	dojo.require('dijit.form.Button');
</script>
<link href="http://ajax.googleapis.com/ajax/libs/dojo/1.5.0/dijit/themes/tundra/tundra.css" rel="stylesheet" type="text/css">

</head>
<body class="tundra">
<form id="test_form"><label><input type="radio"
	checked="checked" class="noStyle" value="0" name="case_convert">none</label><br>
<label><input type="radio" class="noStyle" value="1"
	name="case_convert">lowercase</label><br>
<label><input type="radio" class="noStyle" value="2"
	name="case_convert">uppercase</label><br>
<label><input type="radio" class="noStyle" value="3"
	name="case_convert">propercase</label> <br>
<br>
<button dojoType="dijit.form.Button" type="button">Get value <script
	type="dojo/method" event="onClick" args="evt">
	    var form = dojo.byId( 'test_form' ),
			field = form[ 'case_convert' ],
			value = dojo.fieldToObject( field );

		console.log( 'Results', value, field, form );	
	</script></button>
</form>

</body>
</html>

Change History (3)

comment:1 Changed 8 years ago by Chris Mitchell

Owner: anonymous deleted

comment:2 Changed 7 years ago by bill

Component: GeneralHTML
Owner: set to Eugene Lazutkin

comment:3 Changed 4 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: newclosed

Given that no one has shown interest in creating a patch in the past 4+ years, I'm closing this as patchwelcome.

Note: See TracTickets for help on using tickets.