struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Byron" <>
Subject newbie question about xhtml, html:form, submit button
Date Wed, 03 May 2006 20:12:06 GMT
I've inherited some struts code and I have a question about the html
that it generates.  I have a feeling there's a bunch more stuff I need
to read but I'm having trouble finding it.

I've run the generated html through and it gave me
errors that I don't have end tags on input elements.  The code for an
offending input element is:

<html:text property="address" size="40"/>

So, I added


to my .jsp page and the html validates cleanly.  Unfortunately, my page
doesn't work anymore.

I've got:

  <form id="tryItForm" method="post" action="/mapview/">
	<a href="javascript:document.tryItForm.submit();"><img
class="imgover" alt="" height="21" width="105"

which is generated by:

  <html:form action="/tryItSubmit">
    <a href="javascript:document.tryItForm.submit();"><img
class="imgover" alt="" height="21" width="105"

Unfortunately I get javascript errors in both IE (document.tryItForm is
null or not an object) and firefox (document.tryItForm has no
properties) unless the form element has a name attribute like this:

  <form name="tryItForm" method="post" action="/mapview/">

which is the html that I get without the <html:xhtml/> attribute...

I'm looking for a way to get the validation clean and a working page.
I'm not sure whether this is too much to ask or whether the solution is:

1. patch renderName in to add a name attribute even in the
XHTML case.
2. do something different with the html:text to get valid XHTML
3. somehow change my a href="javascript" so it works, or replace it with
something else that does the same thing.

The DOCTYPE element is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

The DTD there shows that name is a valid attribute for form elements, so
maybe #1 is OK?  If not, can someone point me in the right direction?

I'm using struts 1.2.9.

Thanks much for your help.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message