Re: how to use javascript functions in struts html:form



Hi,

>hi
>i have javascripts file validations.js. and i want to use these javascript
>functions in my jsp pages which use struts html tags..
>i don't know how to invoke these functions from <html:form...(struts html
>tag).
>if it is a ordinary html form i would have done like below
><form name="myform" action="xxxx.jsp" onsubmit="return validate()">
>if i wrote the same with the struts html tag.....it is giving error the is
>no attribute like "name" in html tag lib..
>can any body tell me how to user external javascript functions in the struts
>html tags

1. read the the struts developer documentation; it contains everything
you need to develop valid struts code!

2. read (and understand) the error messages struts gives you; the
error message above tells you that the form tag has no name attribute
and that's correct (goto 1.). But that has nothing to do with
javascript.

3. DON'T use javascript to validate your struts form. Use struts
validation instead! (goto 1.)

4. if you absolutely want to use javascript to validate your form data
then the onsubmit attribute is correct. (goto 1.)

cu
Dirk
.



Relevant Pages

  • Re: OnChange() Event in Struts
    ... > Second list box has to populate values based on counntry selected from ... If you want Struts to handle it, you'll need to submit the form when the ... country changes. ... Using JavaScript to do it on the client side can work, ...
    (comp.lang.java.programmer)
  • Re: Gibt es schon sowas wie eine LongResponsePage mit Struts?
    ... Fall auf JavaScript Funktionalität verlassen kann oder will werde ich ... hätte ich eine solche Komponente am ehesten vermutet. ... Wenn ich unsicher bin kann ich diese Komponenten sogar per Hand ... Bei Struts oder Hibernate ist das aufgrund des Umfangs ...
    (de.comp.lang.java)
  • Question about struts inside javascript variable
    ... i use inside a popup window... ... var cols = hiddenForm.getElementsByTagName; ... but i cannot get it to work because struts seems to make some ... mistake with quotes and in javascript console window i get this error: ...
    (comp.lang.java.programmer)
  • Re: OnChange() Event in Struts
    ... >> I have 2 list box in Jsp Page.The first contain All country names. ... >> to implement this through struts. ... Or look into JSF if you don't want to use javascript (although ... XMLHttpRequest is a great way to do it) ...
    (comp.lang.java.programmer)
  • Re: how to use javascript functions in struts html:form
    ... Seem like you are using struts 1.2.x. ... and you can access the form element with document.getElementById ... > javascript functions in my jsp pages which use struts html tags.. ...
    (comp.lang.java.developer)