开发者

formcollection not see me all inputs

I have a View where some input text to be added dynamica using jquery, I mean everything funzona, and when I go to add these inputs and do right button on the browser I'm not seeing the added input.

function addPerson () (

current + +; 

StrToAdd var = '<table id="compo" name="compo"' + current +'> <tr> <td> <label for="firstname"' + current +'"> Name </ label> <input id = 'firstname' + current + '"name =" Componenti.Nome_ "' +" "+ current +" "+ '" size = "29" /> </ td> <td> <label for = "lastname"' current + + '"> Name </ label> <input id="lastname''" name="Componenti.Cognome_"' + + + current + current'" size="29" /> </ td>' 

StrToAdd + = '<td> <label for="luogonascita"' + current +'"> LuogoNascita </ label> <input id = "luogodinascita' + current + '" name = "Componenti.Luogonascita_"' + "" + current + "" + '"size =" 29 "/> </ td>' 

StrToAdd + = '<td> <label for="datanascita"' + current +'"> DataNacita </ label> <input id = "dateOfBirth' + current + '" name = "Componenti.datanascita_"' + current + ' "size =" 29 "/> </ td> </ tr> </ table> ' 

StrToAdd + = '<script type="text/javascript"> jQuery (function ($) {$("# dateOfBirth' + current + '). mask ("' + mask +'")});</ script > '; 

$ ('# Components'). Append (StrToAdd); 

)

The problem is that when I pass the data via post in the action, and I go to create the education

var valueProvider= formanagrafica.ToValueProvider();

valueProvider I find all the input I have added only one and that therefore there are more than one gives me the values separated by commas开发者_C百科.

How can I retrieve the values of a line of input text? I hope I explained correctly.


You need to have the name attribute for each element to be included in the formcollection. If you have two identical name on different elements, the values will be comma separated at post. All unique names will have their associated values with them.

Example 1

<input name="foo" value="hi">
<input name="foo" value="there">

FormCollection would have one key called "foo" and the value would be "hi,there"

Example 2

<input name="foo1" value="hi">
<input name="foo2" value="there">

FormCollection would have two keys one called "foo1" with the value of "hi" and the second key called "foo2" with the value of "there"

Javascript issue?

I see current + +; at the top of your function call... what is it inialized to? Maybe change it first off to current++; and then after that for debugging sake have alert(current); to see what the value after your increment, to make sure this thing is working correctly.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜