You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by john lee <sh...@yahoo.com> on 2007/09/15 18:33:08 UTC
html:select / DIV / document.getElementById(why).innerHTML
i have 2 html:select, second html:select display corrspondent result after first html:select element is selected, the selection will trigger customried ajax on fly.
second html:select can generate and displayed results, but cannot generate selection box(dropdown list), why? or limition of struts for the html:select?
if i make change to second jsp file, and change from "html:select" to regular "select", the results can display inside dropdown list.
after calling document.getElementById(why).innerHTML, the output of "html:select" why can not be recognized by struts?
any expert can provide input?
tks in advance
john
File1.jsp
<script>
.....
/* some script code to called file2.jsp to generate the result */
.....
document.getElementById(why).innerHTML=response;
.....
</script>
<table>
<tr><td>
<html:select property="course_name" onchange="showstudent(this.form)">
<html:option value="maths"/>
< html:option value="english"/>
</html:select>
</td></tr>
<tr><td>
<div id="why">student name here </div>
</td><tr>
</table>
file2.jsp
<html:select property="student_name">
<html:option value="john"/>
< html:option value="mary"/>
</html:select>
---------------------------------
Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase.
Re: html:select / DIV / document.getElementById(why).innerHTML
Posted by Dave Newton <ne...@yahoo.com>.
--- john lee <sh...@yahoo.com> wrote:
> my jsp just have struts <html:select
> property="studentname"> and <html:option
> value="john"/> and </html:select> only.
HTML input element tags are only valid inside an
<html:form.../> tag. Your fragment does not have a
containing <html:form.../> tag; since you are
returning it with an Ajax call that won't work.
That's why I said you may need to build your HTML by
hand in this case.
d.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: html:select / DIV / document.getElementById(why).innerHTML
Posted by john lee <sh...@yahoo.com>.
Dave,
tks for ur help, I not quite understand your input.
my problem is: if output just generate plain html tag, the output result with dropdown list is fine, but if try to generate <html:select> struts tag, then output display without dropdown list, data still there.
my jsp just have struts <html:select property="studentname"> and <html:option value="john"/> and </html:select> only.
tks so much
john
Dave Newton <ne...@yahoo.com> wrote:
--- john lee wrote:
> after calling
document.getElementById(why).innerHTML,
> the output of "html:select" why can not be
recognized
> by struts?
IIRC the S1 form tags rely on there being an
and will break w/o it (I could
definitely be wrong on this point).
If this is the case, and your JSP fragment contains
only HTML form *element* tags Struts may not know how
to deal with it. You may have to write the HTML by
hand.
d.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------
Tonight's top picks. What will you watch tonight? Preview the hottest shows on Yahoo! TV.
Re: html:select / DIV / document.getElementById(why).innerHTML
Posted by Dave Newton <ne...@yahoo.com>.
--- john lee <sh...@yahoo.com> wrote:
> after calling
document.getElementById(why).innerHTML,
> the output of "html:select" why can not be
recognized
> by struts?
IIRC the S1 form tags rely on there being an
<html:form.../> and will break w/o it (I could
definitely be wrong on this point).
If this is the case, and your JSP fragment contains
only HTML form *element* tags Struts may not know how
to deal with it. You may have to write the HTML by
hand.
d.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org