and

Does it really have two input elements with the same name?

i.e:.

<form 1> <input type="hidden" name="url" value="1"> </form 1> 

and

 <form 2> <input type="hidden" name="url" value="2"> </form 2> 

Is this permissible and permissible?

+51
html validation forms
May 25 '10 at 17:13
source share
6 answers

Yes, in your case, it really is. Consider this:

It's good

 <form name="form1"> <input type="hidden" name="url" value="1"> </form> <form name="form2"> <input type="hidden" name="url" value="2"> </form> 

This is not good

 <form name="form1"> <input type="hidden" name="url" value="1"> <input type="hidden" name="url" value="2"> </form> 
+32
May 25 '10 at 17:15
source share

Yes.

It is also important if you are dealing with switch groups.

+9
May 25 '10 at 17:14
source share

Yes - everyone will send only their forms.

If you have them in the same form, one will override the other, and it is invalid.

+9
May 25 '10 at 17:14
source share

"This is not good" correctly analyzes all browsers that I know of; if two urls appear in the url encoded string, they will be treated as an array. Try this in jQuery:

 $('<form name="form1">\ <input type="hidden" name="url" value="1">\ <input type="hidden" name="url" value="2">\ </form>').serialize() 

and you will get: "url=1&url=2"

A well-written query parser will return a json structure as follows:

  {"url":["1", "2"]} 

Is this a strictly specification? No, but not one of them creates a multi-line string, avoiding the backslash EOL, as I said above.

+6
Nov 24 '14 at 23:47
source share

To check if this is true or not, create a page and test it on the W3C here:

http://validator.w3.org/

+2
May 25 '10 at 17:23
source share
 A) < form 1> < input type="hidden" name="url" value="1"> < /form 1> and < form 2> < input type="hidden" name="url" value="2"> < /form 2> is Okay,beacuse forms submiting time will be different B) < form 1> < input type="hidden" name="url" value="1"> < input type="hidden" name="url" value="2"> < /form 1> is also okay, but not standard coding practice JAVA Code two extract both values :: Map<String,String[]> parmMap = requestObj.getParameterMap(); String input1 = parmMap.get("url")[0]; String input2 = parmMap.get("url")[1]; 
+1
Jan 06 '17 at 14:41
source share



All Articles