开发者

Retrieve value from form

开发者 https://www.devze.com 2022-12-29 05:43 出处:网络
My form is like <form action=\"javascript:;\" method=\"post\" id=\"reportForm\"> <input type=\"text\" name=\"as\" maxlength=\"3\" />

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号