Retrieve value from form
My form is like
<form action="javascript:;" method="post" id="reportForm">
<input type="text" name="as" maxlength="3" />
--CODE--
<html:hidden property="reportid" value="${Sc开发者_C百科ope.reportId}" />
--code--
</form>
I can retrieve values from the form in javascript like
this.form = dojo.byId('reportForm');
this.as1 = this.form.as;
How can i retrieve the value of the html:hidden tag property.
There's no html:hidden
tag defined in the HTML specification. I don't know dojo but I suppose this syntax will eventually render as <input type="hidden" name="reportid" value="foo" />
and you would retrieve its value the same way as the other input tag: this.form.reportid
. You may look with FireBug at the actual DOM.
You can use dojo.formToObject
and pass the form id or DOM node as the parameter. You can get an object that contains the values of all the form elements.
var obj = dojo.formToObject("reportForm");
var id = obj.reportid;
精彩评论