You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Simon Chung <sm...@halfnutz.com> on 2006/10/16 09:28:47 UTC
Struts and DOM2 question.
Hi guys,
I am trying out on how to dynamically add a struts HTML tag to a HTML page
by using javascript. I manage to get it running with normal HTML but I am
having some difficulties in using struts.
Below are my code in HTML (it spawn a new textbox for me):
function addContact(){
var table = document.getElementById('contacts');
var tr = document.createElement('TR');
var td = document.createElement('TD');
var inp = document.createElement('input');
inp.setAttribute('name', 'inp_name');
table.appendChild(tr);
tr.appendChild(td);
td.appendChild(inp);
}
But when I try to do the following using struts tag, it doesn't work(it
doesn't spawn a new textbox for me).
function addContact(){
var table = document.getElementById('contacts');
var tr = document.createElement('TR');
var td = document.createElement('TD');
var inp = document.createElement('html:text');
inp.setAttribute('property', 'inp_name');
table.appendChild(tr);
tr.appendChild(td);
td.appendChild(inp);
}
Anyone who had done this or have any idea on how to get around this? Thanks
in advance for the help.
Cheers,
Simon.
RE: Struts and DOM2 question.
Posted by "Amit Kumar Singh (C)" <cc...@sapient.com>.
Hi Simon,
As I had faced this issue some times back and the conclusion is that the
struts <html:text> is not supported by DOM.
You can use simple HTML's text instead of it. Not sure if this bug has
been fixed.
Thanks,
Amit
-----Original Message-----
From: Simon Chung [mailto:smchung@halfnutz.com]
Sent: Monday, October 16, 2006 12:59 PM
To: dev@struts.apache.org
Subject: Struts and DOM2 question.
Hi guys,
I am trying out on how to dynamically add a struts HTML tag to a HTML
page
by using javascript. I manage to get it running with normal HTML but I
am
having some difficulties in using struts.
Below are my code in HTML (it spawn a new textbox for me):
function addContact(){
var table = document.getElementById('contacts');
var tr = document.createElement('TR');
var td = document.createElement('TD');
var inp = document.createElement('input');
inp.setAttribute('name', 'inp_name');
table.appendChild(tr);
tr.appendChild(td);
td.appendChild(inp);
}
But when I try to do the following using struts tag, it doesn't work(it
doesn't spawn a new textbox for me).
function addContact(){
var table = document.getElementById('contacts');
var tr = document.createElement('TR');
var td = document.createElement('TD');
var inp = document.createElement('html:text');
inp.setAttribute('property', 'inp_name');
table.appendChild(tr);
tr.appendChild(td);
td.appendChild(inp);
}
Anyone who had done this or have any idea on how to get around this?
Thanks
in advance for the help.
Cheers,
Simon.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org