Hello everybody!! im new on tapestry and i have a little question, how can i
get the value of an input that was dynamically added into the form with
javascript, i know that is easy to add inputs whit ajax but i realy think
that its faster and better specially for tapestry type apps, so this is the
html code, any suggestion?

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
<head>DOM</head>
<script type="text/javascript">
function addRecord(){
var count = document.getElementById("count");
var rows = document.getElementById("rows");
count.setAttribute("value", parseInt(count.value,0)+1);
var table = document.getElementById("content").tBodies[0];
var row = document.createElement("TR");

var cell1 = document.createElement("TD");
var nameBox = document.createElement("INPUT");
nameBox.setAttribute("type","TextField");
nameBox.setAttribute("name","nameBox" + count.value);

var button = document.createElement("a");
button.setAttribute('value','Delete');
button.innerHTML = count.value;
button.onclick=function(){deleteRecord(this);}

cell1.appendChild(button);
cell1.appendChild(nameBox);

row.appendChild(cell1);
table.appendChild(row);

nameBox.focus(); 
}
function deleteRecord(button){
var row = button.parentNode.parentNode;
var table =
document.getElementById('content').getElementsByTagName('tbody')[0];
table.removeChild(row);
}

</script>
<body onLoad="addRecord()">
<input name="count" type="hidden" id="count" value="0" />
<input name="rows" type="hidden" id="rows" value="" />
<t:form t:id="myForm">
<table id="content">
  <tr>
    <td width="150" class="orillat">Names</td>
  </tr>
</table>
<table>
  <tr>
    <td>
        <input type="button" value="add row" onClick="addRecord()" />
        <input type="submit" onClick="rows.value=count.value, count.value="0"
/></td>
    </td>
  </tr>
</table>
</t:form>
</body>
</html>

i apreciate any help
-- 
View this message in context: 
http://www.nabble.com/Javascript-DOM-and-tapestry5-tp21111696p21111696.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to