struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Byron" <DBy...@telecomsys.com>
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 validator.w3.org 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

<html:xhtml/>

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/tryItSubmit.do">
	<a href="javascript:document.tryItForm.submit();"><img
class="imgover" alt="" height="21" width="105"
src="images/btn/btn_ok.gif"></a>
  </form>

which is generated by:

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

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/tryItSubmit.do">

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 FormTag.java 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"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

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.

-DB

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message