Thanks!! Howard, exactly what i was looking for, tapestry is a very nice
project just need more tutorials, here is the code if someone else had the
same question

-Dom.tml-
<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("id","nameBox");
nameBox.setAttribute("name","nameBox");

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(); 
nameBox.onblur=function(){addRecord();}
}
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="" />
<form t:type="form" t:id="myForm">

<table id="content">
  <tr>
    <td>Names</td>
  </tr>
</table>
<table>
  <tr>
    <td>
        <input type="submit" onClick="rows.value=count.value, count.value=0" />
    </td>
  </tr>
</table>
</form>
</body>
</html>


-Dom.java-
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.Service;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.Request;

public class Dom {      
         @Inject
         @Service("Request")
         private Request request;        
         @OnEvent(component = "myForm", value="SUCCESS")
         void proced()
        {
                String a[] =request.getParameters("nameBox");
                for (int i=0;i<a.length;i++)
                System.out.println(a[i]);               
        }       
}
-- 
View this message in context: 
http://www.nabble.com/Javascript-DOM-and-tapestry5-tp21111696p21120290.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