Problem with Client Side Validator - e.getFacesMessage is not a function

(JDeveloper 11g, TP2 and TP3)
I have created a custom validator that does server side validation as well as client side validation. It gets invoked - an alert is fired to prove that - but when validation fails, instead of the red box and error message that I was hoping for, I get a JavaScript error:
e.getFacesMessage is not a function (all-11-otn2.js (line 27600))
The getClientScript() method in the validator looks like this:
    public String getClientScript(FacesContext facesContext,
                                  UIComponent uIComponent) {
        return "function GreaterThanValidator(p1)\n" +
        "{  this.greaterThanItem=p1; \n" +
        "}\n" +
        "GreaterThanValidator.prototype.validate = function(value){" +
                       "alert('value= '+value); " +
        " if (!(value=='X')){ " +
        "    return new ValidatorException('Value must not be X '" +
        "         +' (current value = '+value+')');}"+
    }   Can someone tell me what I am doing wrong here? Like I said, the validation is performed, the alert is shown. Then when I raise the ValidatorException, the error occurs.
thanks for any suggestions.
Lucas
Message was edited by:
Lucas Jellema
Message was edited by:
Lucas Jellema
Message was edited by:
Lucas Jellema

Lucas,
I assume that this post is related to the previous
Display client side validation error message with the pretty box
I forwarded this internally and am waiting for a hint. Will update this post accordingly (or someone else will do directly)
Frank

Similar Messages

  • Having problem with client side Authentication.

    Hi,
    I am haveing a problem enabling client side authentication with SSL on
    weblogic 5.1.
    I have set up the .properties files as explained, however it appears
    my client is not sending a certificate back to the server. The same
    client however works perfectly (using the same keystore file) with a
    sample ClassFileSErver webserver from the jsse distribution. (the
    client is a very slightly modified version of
    SSLSocketClientWithClientAuth sample that comes with Jsse)
    Below I've included a section of the debug dump from the interactions.
    The only other difference I can see is the cipher suites offered by
    the servers.
    Weblogic offers type 0 or 9, and agrees on type 9
    (SSL_RSA_WITH_DES_CBC_SHA), whereas ClassFileServer offer type 0 or 5
    and settles on type 5 (SSL_RSA_WITH_RC4_128_SHA).
    I am using the same keystore for both examples. Both servers request
    an RSA client cert.... I'm out of ideas.
    Any help would be greatfully received.
    Cheers,
    Keith
    Debug dump information
    =====================================
    1/Weblogic server.
    *** CertificateRequest
    Cert Types: RSA,
    Cert Authorities:
    <CN=K H, OU=itsmobile, O=itsmobile, L=Dublin, ST=Dublin, C=ie>
    <[email protected], CN=Demo Certificate Authority,
    OU=Security, O=BEA WebLogic, L=San Francisco, ST=California, C=US>
    <CN=Thawte Test CA Root, OU=TEST TEST TEST, O=Thawte Certification,
    ST=FOR TESTING PURPOSES ONLY, C=ZA>
    [read] MD5 and SHA1 hashes: len = 427
    0000: 0D 00 01 A7 01 01 01 A3 00 67 30 65 31 0B 30 09
    .........g0e1.0.
    0010: 06 03 55 04 06 13 02 69 65 31 0F 30 0D 06 03 55
    ..U....ie1.0...U
    0020: 04 08 13 06 44 75 62 6C 69 6E 31 0F 30 0D 06 03
    ....Dublin1.0...
    0030: 55 04 07 13 06 44 75 62 6C 69 6E 31 12 30 10 06
    U....Dublin1.0..
    0040: 03 55 04 0A 13 09 69 74 73 6D 6F 62 69 6C 65 31
    .U....itsmobile1
    0050: 12 30 10 06 03 55 04 0B 13 09 69 74 73 6D 6F 62
    .0...U....itsmob
    0060: 69 6C 65 31 0C 30 0A 06 03 55 04 03 13 03 4B 20
    ile1.0...U....K
    0070: 48 00 AC 30 81 A9 31 0B 30 09 06 03 55 04 06 13
    H..0..1.0...U...
    0080: 02 55 53 31 13 30 11 06 03 55 04 08 13 0A 43 61
    .US1.0...U....Ca
    0090: 6C 69 66 6F 72 6E 69 61 31 16 30 14 06 03 55 04
    lifornia1.0...U.
    00A0: 07 13 0D 53 61 6E 20 46 72 61 6E 63 69 73 63 6F ...San
    Francisco
    00B0: 31 15 30 13 06 03 55 04 0A 13 0C 42 45 41 20 57
    1.0...U....BEA W
    00C0: 65 62 4C 6F 67 69 63 31 11 30 0F 06 03 55 04 0B
    ebLogic1.0...U..
    00D0: 13 08 53 65 63 75 72 69 74 79 31 23 30 21 06 03
    ..Security1#0!..
    00E0: 55 04 03 13 1A 44 65 6D 6F 20 43 65 72 74 69 66 U....Demo
    Certif
    00F0: 69 63 61 74 65 20 41 75 74 68 6F 72 69 74 79 31 icate
    Authority1
    0100: 1E 30 1C 06 09 2A 86 48 86 F7 0D 01 09 01 16 0F
    .0...*.H........
    0110: 73 75 70 70 6F 72 74 40 62 65 61 2E 63 6F 6D 00
    [email protected].
    0120: 8A 30 81 87 31 0B 30 09 06 03 55 04 06 13 02 5A
    .0..1.0...U....Z
    0130: 41 31 22 30 20 06 03 55 04 08 13 19 46 4F 52 20 A1"0
    ..U....FOR
    0140: 54 45 53 54 49 4E 47 20 50 55 52 50 4F 53 45 53 TESTING
    PURPOSES
    0150: 20 4F 4E 4C 59 31 1D 30 1B 06 03 55 04 0A 13 14
    ONLY1.0...U....
    0160: 54 68 61 77 74 65 20 43 65 72 74 69 66 69 63 61 Thawte
    Certifica
    0170: 74 69 6F 6E 31 17 30 15 06 03 55 04 0B 13 0E 54
    tion1.0...U....T
    0180: 45 53 54 20 54 45 53 54 20 54 45 53 54 31 1C 30 EST TEST
    TEST1.0
    0190: 1A 06 03 55 04 03 13 13 54 68 61 77 74 65 20 54
    ...U....Thawte T
    01A0: 65 73 74 20 43 41 20 52 6F 6F 74 est CA Root
    main, READ: SSL v3.0 Handshake, length = 4
    *** ServerHelloDone
    [read] MD5 and SHA1 hashes: len = 4
    0000: 0E 00 00 00 ....
    main, SEND SSL v3.0 ALERT: warning, description = no_certificate
    main, WRITE: SSL v3.0 Alert, length = 2
    And below is a sample when I used the ClassFileServer.
    This time the client (same src) returned a certificate.
    2/ClassFileSErver (from Sun Jsse distribution)
    *** CertificateRequest
    Cert Types: DSS, RSA,
    Cert Authorities:
    <CN=K H, OU=itsmobile, O=itsmobile, L=Dublin, ST=Dublin, C=ie>
    [read] MD5 and SHA1 hashes: len = 114
    0000: 0D 00 00 6E 02 02 01 00 69 00 67 30 65 31 0B 30
    ...n....i.g0e1.0
    0010: 09 06 03 55 04 06 13 02 69 65 31 0F 30 0D 06 03
    ...U....ie1.0...
    0020: 55 04 08 13 06 44 75 62 6C 69 6E 31 0F 30 0D 06
    U....Dublin1.0..
    0030: 03 55 04 07 13 06 44 75 62 6C 69 6E 31 12 30 10
    .U....Dublin1.0.
    0040: 06 03 55 04 0A 13 09 69 74 73 6D 6F 62 69 6C 65
    ..U....itsmobile
    0050: 31 12 30 10 06 03 55 04 0B 13 09 69 74 73 6D 6F
    1.0...U....itsmo
    0060: 62 69 6C 65 31 0C 30 0A 06 03 55 04 03 13 03 4B
    bile1.0...U....K
    0070: 20 48 H
    *** ServerHelloDone
    [read] MD5 and SHA1 hashes: len = 4
    0000: 0E 00 00 00 ....
    matching client alias : rsakey
    *** Certificate chain

    Matt,
    Did you read this article:
    https://wiki.sdn.sap.com/wiki/display/BSP/Using%20Proxies
    This explains how to properly setup the HTTPURLLOC table.
    In your case you should have entries that look something like this:
    40 HTTP   * <internal host name> <https port>
    50 HTTPS * <external host name> <https port>
    In addition you need to run the report to determine if the proxy configuration is setup properly.  The URL should be run with the
    https://<externalhostname>/sap/bc/bsp/sap/system_test/test_proxy.htm
    Take care,
    Stephen

  • Problem with client side printing

    hi ,
    am using struts and jasper reports on my project, now i was having problem that whenever i try to print the report , the printer dialogue box was appearing on server machine, i want it on client end, how to solve this problem, please any one know help me, it was urgent,
    my code was like this
    JasperCompileManager.compileReportToFile("c:/report/test.jrxml","c:/report/test.jasper");
    JasperPrint jasperPrint = JasperFillManager.fillReport("c:/report/test.jasper"),parameters,con);
    List l=jasperPrint.getPages();                         
    if(l.size() != 0){
      jasperPrint.setOrientation(JasperReport.ORIENTATION_PORTRAIT);
      jasperPrint.setPageHeight(877);
      jasperPrint.setPageWidth(963);
      JasperPrintManager.printPages(jasperPrint,0,l.size()-1,true);
    }thanks in advance,

    Throw away the code that generates a JasperPrint object and tries to print it. (All of the code, in other words, except maybe the first line.) As you found, that tries to print on the machine where the code is running. Replace it by Jasper code that produces PDF or HTML, and send that as the response. Let the person sitting at the browser deal with printing it if they want.

  • Problem with client side printing, please help its urgent

    hi ,
    am using struts and jasper reports on my project, now i was having problem that whenever i try to print the report , the printer dialogue box was appearing on server machine, i want it on client end, how to solve this problem, please any one know help me, it was urgent,
    my code was like this
    JasperCompileManager.compileReportToFile("c:/report/test.jrxml","c:/report/test.jasper");
    JasperPrint jasperPrint = JasperFillManager.fillReport("c:/report/test.jasper"),parameters,con);
    List l=jasperPrint.getPages();                         
    if(l.size() != 0){
      jasperPrint.setOrientation(JasperReport.ORIENTATION_PORTRAIT);
      jasperPrint.setPageHeight(877);
      jasperPrint.setPageWidth(963);
      JasperPrintManager.printPages(jasperPrint,0,l.size()-1,true);
    }thanks in advance,

    Double post.

  • Struts 2 Client side validation getting skipped.

    I am doing a simple program using struts 2. Usually in struts2 bean class will be combined with action class unlike in struts 1.2. But for enhancing readability I made a seperate bean class and I reference it in my action class. But after seperating bean from action class Client side validation using xml is not happening. It is getting skipped. But server side validation inside execute() is happening. Will anyone please help me to find a solution to make client side validation run.
    here are the different files.
    1) JSP File - SEmail.jsp
    <%@ taglib prefix="s" uri="/struts-tags"%>
    <html>
    <s:head theme="ajax" />
    <title>SEmail </title>
    <body>
    <center><font color="blue" size="5" face="bold">
    <s:label     value="Secure Email - Non Registered User" /> </font></center>
    <br>
    <font color="red" size="3"> <s:label
         value="Want to contact us?."></s:label>
    </font>
    <center><s:form action="/Semail.action" method="POST"
         validate="true">
         <s:actionerror />
         <s:select label="Topic" name="user.topic" headerKey="-1" required="true"
              list="#{'Plan Coverage':'Plan Coverage','Sales':'Sales','Others':'Others'}">
         </s:select>
         <s:textarea name="user.message" label="Message" rows="4" cols="50"
              required="true" />
         <br>
         <s:label value="Contact Information" />
         <br>
         <table align="center" width="500">
              <tr align="left">
                   <td align="left"><s:select label="Title" name="user.title"
                        headerKey="-1" required="true"
                        list="#{'-- Select One --':'-- Select One --','Mr.':'Mr.','Ms.':'Ms.','Mrs.':'Mrs.'}">
                   </s:select></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="First Name"
                        name="user.firstname" size="20" maxlength="35" required="true" /></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="Family Name"
                        name="user.familyname" size="20" maxlength="35" required="true" /></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="Profession"
                        name="user.profession" size="20" maxlength="20" /></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="Address" name="user.address"
                        size="20" maxlength="100" /></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="Telephone Number"
                        name="user.telnumber" size="20" maxlength="20" /></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="P.O. Box" name="user.pobox"
                        size="20" maxlength="8" /></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="City"
                        name="user.emirate" size="20" maxlength="35" required="true" /></td>
              </tr align="left">
              <tr>
                   <td align="left"><s:textfield label="Region and Country"
                        name="user.country" size="20" maxlength="35" /></td>
              </tr>
              <tr align="left">
                   <td align="left"><s:textfield label="E-mail Address"
                        name="user.email" size="20" maxlength="70" required="true" /></td>
              </tr>
         </table>
         <br>
         <s:file name="user.uploadFile" label="Upload Document" />
         <br>
         <br>
         <s:submit value="Submit" align="center"></s:submit>
    </s:form></center>
    <font color="red" size="3"> <s:label
         value="All fields marked (*) are mandatory."></s:label>
    </body>
    </html>
    2) struts.xml
    <!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
    <struts>
         <package name="semail" extends="struts-default">
              <action name="Semail" class="semail.NonregUser">
                   <result name="input">/SEmail.jsp</result>
                   <result name="error">/SEmail.jsp</result>
                   <result>/SEmail.jsp</result>
              </action>          
         </package>     
    </struts>
    3) Bean Class - User.java
    package semail;
    public class User {
         private String topic;
         private String message;
         private String title;
         private String firstname;
         private String familyname;
         private String profession;
         private String address;
         private int telnumber;
         private String pobox;
         private String city;
         private String country;
         private String email;
         private String uploadFile;
         private String testing;
         public String getTopic() {
              return topic;
         public void setTopic(String topic) {
              this.topic = topic;
         public String getMessage() {
              return message;
         public void setMessage(String message) {
              this.message = message;
         public String getTitle() {
              return title;
         public void setTitle(String title) {
              this.title = title;
         public String getFirstname() {
              return firstname;
         public void setFirstname(String firstname) {
              this.firstname = firstname;
         public String getFamilyname() {
              return familyname;
         public void setFamilyname(String familyname) {
              this.familyname = familyname;
         public String getProfession() {
              return profession;
         public void setProfession(String profession) {
              this.profession = profession;
         public String getAddress() {
              return address;
         public void setAddress(String address) {
              this.address = address;
         public int getTelnumber() {
              return telnumber;
         public void setTelnumber(int telnumber) {
              this.telnumber = telnumber;
         public String getPobox() {
              return pobox;
         public void setPobox(String pobox) {
              this.pobox = pobox;
         public String getCity() {
              return city;
         public void setCity(String city) {
              this.city= city;
         public String getCountry() {
              return country;
         public void setCountry(String country) {
              this.country = country;
         public String getEmail() {
              return email;
         public void setEmail(String email) {
              this.email = email;
         public String getUploadFile() {
              return uploadFile;
         public void setUploadFile(String uploadFile) {
              this.uploadFile = uploadFile;
         public String getTesting() {
              return testing;
         public void setTesting(String testing) {
              this.testing = testing;
    This is my bean class. Instead of putting it with action class NonregUser.java , I have seperated it out for readability. And I am referencing it in the action class.
    4) Action Class - NonregUser.java
    package semail;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts2.interceptor.ServletRequestAware;
    import org.apache.struts2.interceptor.ServletResponseAware;
    import com.opensymphony.xwork2.ActionSupport;
    public class NonregUser extends ActionSupport implements ServletRequestAware,
              ServletResponseAware {
         private static final long serialVersionUID = 2451855813074437309L;
         HttpServletRequest request = null;
         HttpServletResponse response = null;
         private User user = null;
    /* I am referencing my bean class here instead of writing all the getters and setters here.*/
         public User getUser() {
              return user;
         public void setUser(User user) {
              this.user = user;
         public String execute() throws Exception {
              System.out.println("Validating login");
              if(user!=null){
                   System.out.println(user.getFirstname());
                   System.out.println(user.getEmail());
                   System.out.println(user.getTopic());
                   System.out.println(user.getTitle());
    // this server side validation is happening
                   if (user.getTitle().trim().equals("-- Select One --")) {
                        addActionError("Please select Title");
                        return ERROR;
                   } else {
                        return SUCCESS;
              }else{
                   return SUCCESS;
         public void setServletRequest(HttpServletRequest arg0) {
              System.out
                        .println("HttpServletRequest : " + NonregUser.this.getClass());
              request = arg0;
         public void setServletResponse(HttpServletResponse arg0) {
              System.out.println("HttpServletResponse : "
                        + NonregUser.this.getClass());
              response = arg0;
    This is my acation class. Here I am referencing my bean class User.java.
    5) xml validation file - NonregUser-validation.xml
    /*This client validatin is not working*/
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE validators PUBLIC
              "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
              "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
    <validators>
         <field name="topic">
              <field-validator type="requiredstring">
                   <param name="trim">true</param>
                   <message>Please select the Topic</message>
              </field-validator>
         </field>
         <field name="message">
              <field-validator type="requiredstring">
                   <param name="trim">true</param>
                   <message>Please enter Message</message>
              </field-validator>
              <field-validator type="stringlength">
                   <param name="maxLength">8000</param>
    <message>Message cannot contain more than 8000 characters</message>
              </field-validator>
         </field>
         <field name="title">
              <field-validator type="requiredstring">
                   <param name="trim">true</param>
                   <message>Please select the Title</message>
              </field-validator>
         </field>
         <field name="firstname">
              <field-validator type="requiredstring">
                   <param name="trim">true</param>
                   <message>Please enter First name</message>
              </field-validator>
              <field-validator type="stringlength">
                   <param name="maxLength">35</param>
    <message>First Name cannot contain more than 35 characters</message>
              </field-validator>
         </field>
         <field name="familyname">
              <field-validator type="requiredstring">
                   <param name="trim">true</param>
                   <message>Please enter Family name</message>
              </field-validator>
              <field-validator type="stringlength">
                   <param name="maxLength">35</param>
    <message>Family Name cannot contain more than 35 characters</message>
              </field-validator>
         </field>
         <field name="emirate">
              <field-validator type="requiredstring">
                   <param name="trim">true</param>
                   <message>Please enter Emirate/City</message>
              </field-validator>
         </field>
         <field name="email">
              <field-validator type="requiredstring">
                   <param name="trim">true</param>
                   <message>Please enter Email address</message>
              </field-validator>
              <field-validator type="email">               
                   <message>Please enter a valid Email address</message>
              </field-validator>
         </field>
    </validators>
    6) web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app>
         <filter>
         <filter-name>struts2</filter-name>
         <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
         </filter>
         <filter-mapping>
         <filter-name>struts2</filter-name>
         <url-pattern>/*</url-pattern>
         </filter-mapping>
         <welcome-file-list>          
              <welcome-file>/SEmail.jsp</welcome-file>
         </welcome-file-list>     
         <error-page>
    <error-code>404</error-code>
    <location>/pagenotfound.jsp</location>
    </error-page>
    <error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/error.jsp</location>
    </error-page>
    </web-app>
    Edited by: L-J-K on Jul 22, 2008 5:22 AM

    I was trying to do it through creating a new validators.xml where I would redefine all struts built in validations and add de definition for my custom Validation (<validator name="checkUser" class="com.custom.CustomUserValidator"/>). Then I define the ActionClassName-action-validation.xml refering to my custom validator (checkUser). The com.custom.CustomUserValidator Class has to extend FieldValidatorSupport or ValidatorSupoort (depending on what kind of validation).
    Ok that's it, this is the theory, now the custom validator (checkUser) is executed before my action but I don't know how to do it so that if the validation fails i return to the same page showing the error message to the user without having to execute the target action. Does anyone know how to do this????

  • Af:query client side validation

    Hello,
    I have an application with 2 ViewObjects (based on SQL), each with its own ViewCriteria. I have 2 pages, each containing 1 of the ViewCriteria as af:query with results table. Each ViewCriteria has a number of fields, all f which are selectively required.
    Now, when I go to page A, leave all fields empty and hit 'search', my fields get marked immediately as 'you need to enter at least one of the criteria'. No server request, just pure client validation, as you'd expect. Now we go to page B, doing exactly the same (empty fields, search). I see a lot of activity now, a server request, a query executed, and then a stacktrace saying 'at least 1 attribute is required'. In the front end, I also get a popup saying I have to enter at least 1 value.
    Does anyone have any idea why the validation for both af:query components is different? Both ViewObject look the same to me, with same properties and attributes set.
    Thanks in advance,
    Stijn.

    Thanks for the reply, Vinod.
    The problem still persists, though. We're working with version 11.1.3 (where the issue should be fixed), and it doesn't happen every time. 8 out of 10 af:query-components we use go to the server before validating the input, resulting in a popup. The other 2 do client-side validation and immediately tell you to fill in the blanks (which is the behaviour we want)...

  • ADF validator or JavaScript for client side validation ?

    using JDev and ADF 11g
    Problem description : To apply validations such as date range check, pattern matching, maxlength etc.. on ADF Faces Components.
    Solution 1: Use ADF validator such as Reg Expr validator, Max Length validator
    Souliton 2: Write Javascript code for validating the component's value at cleint side.
    When using ADF Validator for such type of validation checking, a request is send to the server for processing (additional overhead) . However we can do such validations with javaScript functions without the need to interact with the server. So, what benefit does ADF Validator serves when one needs to implement such validations ?
    Please share your views...

    H,
    afaik, client side validation in ADF Faces suppresses server round trips if a validation error is detected on the client. Only if no problem is found, the server side validation is challenged upon submit (so no extra round trip for validation). Shay is absolutely correct. JavaScript is a convenience but never a solution.
    Here's how to create a custom validator with a client and server side implementation : http://download.oracle.com/docs/cd/E15523_01/web.1111/b31973/af_validate.htm#BABEIIDD
    Frank

  • How to Disable client side validation for the message text input

    Hi,
    I have scenario where i need to by pass the client side validation for a message text input
    Scenario is
    I have a message text input field(say XYZ), i set the max length for the item as 20
    Now when im trying to enter the greek characters into it, it is allowing me to enter till 20 characters
    But when i try to submit the form ..my client side validation is firing..
    The Error says the XYZ is too long
    The problem is, in greek each character takes two bytes.(In english it is only 1).While entering the content it allowing 20 characters and when validating it is checking for bytes(if we enter in greek the length will be 40 bytes not 20)
    I cannot increase the max length .coz i have restrict the character length to 20 only.(english or Greek).
    Please help me in this regard.
    Regards
    Sandeep.

    Thanks for the information.But we dont have any option either declaratively or programatically to disable the client side validation for the message text input..I referred java docs ..i dint find any method which does..
    Correct me if im wrong

  • STRUTS: client-side validation in jsp using  DynaValidatorForm

    I am supposed to work on struts on as project and it is like learning a crash course and work the next day.
    In Struts 1.1 enviroment, I am using DynaValidatorForm to create a bean form and then perform validation.
    1. I write a DynaValidatorForm definition in struts-config.xml
    2. I write xml for action so that when /getQuotes.do in invoked by a jsp form, the form data is put into the QuoteDetailsBean.
    3. add the plugin script for ValidatorPlugIn
    xml fragment from struts-config:
    //form bean
    <form-beans>
    <form-bean name="QuoteDetailsBean" type="org.apache.struts.validator.DynaValidatorForm">
        <form-property name="forename" type="java.lang.String"/>
       <form-property name="surname" type="java.lang.String"/>
    <form-bean>
    </form-beans>
    <action
            path="/getQuotes"
            type="com.kainos.quickquotes.struts.QQGetQuotesAction"
            validate="true"
            name="QuoteDetailsBean"
            input="/userform1.do"
            parameter="save"
            scope="session">
            <forward name="success" path="/pages/jsp/result.jsp"/>
            <forward name="back" path="/userform1.do"/>
    </action>
    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
         <set-property
             property="pathnames"
             value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
      </plug-in>Now I write a validation code for getQuotes.do. note that I can write the validation code with
    <form name="QuoteDetailsBean"> but this form bean is shared by many jsp, so i am using the name of the action
    (getQuotes) as the name of the form in the validation.xml.
    So far this looks okay, as I am going by some example.
    xml fragment from validation.xml:
    <formset>
              <form name="/getQuotes">
                 <field property="forename" depends="required,minlength">
                    <arg0 key="QuoteDetailsBean.forename" />
                    <arg1 name="minlength" key="${var:minlength}" resource="false"/>
                    <var>
                       <var-name>minlength</var-name>
                       <var-value>2</var-value>
                    </var>
                 </field>
                 <field property="surname" depends="required,minlength">
                <arg0 key="QuoteDetailsBean.surname" />
                <arg1 name="minlength" key="${var:minlength}" resource="false"/>
                <var>
                   <var-name>minlength</var-name>
                   <var-value>2</var-value>
                </var>
                 </field>
    </formset>Now I write the JSP. I use the <html:javascript> tag to allow front-end validation based on the xml in validation.xml.
    The jsp code:
    <%@ taglib uri="/tags/struts-bean" prefix="bean" %>
    <%@ taglib uri="/tags/struts-html" prefix="html" %>
    <%@ taglib uri="/tags/struts-logic" prefix="logic" %>
    <html:html locale="true">
    <head>
    <title><bean:message key="welcome.title"/></title>
    <html:base/>
    <html:javascript formName="/getQuotes"
                method="validateForm"
                dynamicJavascript="true"
                staticJavascript="false"
                cdata="false" />
    </head>
    <body bgcolor="#FFCC9F">
    <html:errors />
    <html:form action="getQuotes.do" onsubmit="return validateForm(this);" >
    Forename:</td> <td>���<html:text property="forename"/></td></tr>
    <tr> <td>Surname:</td> <td>���<html:text property="surname"/></td></tr>
    <html:submit value="Quotes" /></td></tr>
    </html:form>
    </body>
    </html:html>Does this looks okay. I wrote so far based on some tutorials n help online.
    Now when I open the JSP and then do a submit, there is no validation (I tried by submitting with empty forename and surname. I mean i could invoke the action class and the invoke class
    redirects(forwards) to the appropriate path. so the code works fine except validation is not done
    Q1. So what should i do more to get client-side validation?
    What actually happens in client-side validation? does a pop up alert appears?
    nothing happens so far in my case.
    Q2. What should I do more for server side validation. Since the form is incomplete, what happens?
    I thought the same form returns and the error messages are printed in the jsp page since i have the <html:errors />
    tag just below the <body> tag.
    The action class is pretty simple so far:
    public class QQGetQuotesAction extends Action {
        public QQGetQuotesAction(){
    public ActionForward execute(ActionMapping mapping,
                 ActionForm form,
                 HttpServletRequest request,
                 HttpServletResponse response)
        throws Exception {
            DynaValidatorForm dynaform = (DynaValidatorForm)form;
            System.out.println("forename:"+dynaform.get("forename");
            System.out.println("surname:"+dynaform.get("surname");
            return forward=mapping.findForward("back");
    }Please help me out. I think I am missing something which i need to do
    thanks
    Tanveer

    I think the validations are to be declared on the form
    name and not the action path.
    Your formName is QuoteDetailsBean but your are using
    the action path(/getQuotes) both in the validation
    rules and the jsp tags. Use the formName on both the
    places.
    Also your html:javascript tag will not generate the
    static javascript to validate the fields. For this you
    will have to add code like below.
    <html:javascript dynamicJavascript="false"
    staticJavascript="true"/>
    Other options is to set the attribute
    staticJavascript="true" in your html:javascript tag.
    Hope it helps.hi
    staticJavascript="true" did the trick. :)
    I think the validations are to be declared on the form name and not the action path.It is not necessary. You can declare the validation on the action class. This is essential if a form bean is shared by several JSPs having its own action class. This is as per as I read in a tutorial and it works.

  • Client side validation in struts using validation framework

    Hi ,
    am new to struts.....
    I want to validate a simple login page using struts validation framework...
    For that i created,
    login.jsp ( contains html:errors and html:javascript and onsubmit)
    LoginForm extends ValidatorForm
    LoginAction
    resource bundles
    validation.xml ( required, minlength and maxlength rules for both fields)
    struts-config.xml ( configured action mapping and form beans)
    whats my problem is....
    i will get error messages through server side validation...
    i cant able to get the error messages using javascript i.e alert messages.
    i seen the page resource in that all javascript functins are inserted.
    on seeing the javascript error console... it shows
    formName has no properties...............
    exactly at this line
    oRequired = eval('new ' + formName.value + '_required()'); //function validateRequired(form)

    Thanks for your valuable reply.....
    Ya of course what you said was correct....
    I got error messages while submitting the form without any value....
    error messages are displayed using the <html:errors/> tag (server side validation ).
    But it fails to show the alert messages for those errors ( client side validation).
    i inserted the <html:javascript formName="form bean name" /> tag in the bottom of my login jsp.....
    on seeing the error console, it shows formName has no properties.
    Could anybody help me to sort out this problem........

  • Link only with client side method for ImageArea

    Hi,
    I wanted to made an ImageMap and on each ImageArea set Link ONLY with client side method. But it doesnt work, no method is called. (in html is rendered only onClick="return false;"). When i tried to set some server side method it is working(server method is called). Is this righ behavior?
    If it is how should code for calling only client side method look like?(now i am writing that map into html by myself, but it is not nice solution ).
    And next question related to this, where is defined relationship betwenn htmlb components and java classes rendering them? i wanted to look in implemenattion of imagemap and change it for my purposes but i dont know how.
    thanks
    JJ

    I had also some problems with the ImageMap.
    I ended up by using the "HTML-way"
    <map name="Innen">
    <area shape="rect" coords="460,46,494,365" href="#" title="W7" alt="W7" onclick='alert("Nicht belegt")'>
    <area shape="rect" coords="429,92,457,365" href="#" title="W3" alt="W3" onclick='alert("Nicht belegt")'>
    </map>
    <img align="LEFT" src=<%= """ + componentRequest.getWebResourcePath()+ "/images/spannbacke_innen.gif" + """ %> width="500" border="0" alt="Karte" usemap="#Innen">                    
    Walter

  • How to make client side validations using NWDS

    Hi Frndz..
                   Am creating UIs using NWDS ,i made tthe validations @ servr side n i have 2 made this validations @ clinet side ,but am not aware how it is????
    can anyone help me in this regard.
    THANKS & REGARDS
    Rajesh Kumar

    chk it
    /people/martin.kellermann2/blog/2006/12/17/client-side-input-validation-with-htmlb--the-basics
    http://help.sap.com/saphelp_nw04/helpdata/en/43/067941a51a1a09e10000000a155106/frameset.htm
    /people/kirupanand.venkatapathi2/blog/2005/12/18/client-side-validation-in-dynpage
    http://help.sap.com/saphelp_nw04s/helpdata/en/8e/e3a942ad920c31e10000000a1550b0/frameset.htm
    /thread/86123 [original link is broken]
    https://media.sdn.sap.com/html/submitted_docs/dotnet/Programming%20with%20PDK%20for%20.NET/SAP%20NetWeaver%20.NET%20Controls/Event%20Handling/Client%20Side%20Event%20Handling.htm

  • Client side validation in J2SE (Desktop applications)

    Hi,
    I am new to J2SE(desktop applications). I created a GUI screen with the help of Swing. I would like to add some client-side validation to my GUI e.g Required field validator, regular expression validator etc. Can you please provide me with some sample code?
    Regards,
    ap.

    Regular Expressions - http://java.sun.com/docs/books/tutorial/essential/regex/
    For required fields, just don't allow the user to continue unless getText() on the field returns appropriate data.

  • Client-side validation

    Hello,
    I am trying to do client-side validation using the JSF.
    I would like to know if it is possible, if JSF furnishes some help to do it...
    If someone have some examples, it would be a great help.
    Thanks,
    Marie.

    Thank you very much for the link.
    I read the document but it did not completely solve my problem. Indeed, all the examples are about a client-side validation at the submit phase. And I am trying to do a client-side validation on the focus lost of each field.
    I know that I can do it by adding the attribute focusLost on the field and by adding the javascript corresponding to the validation of this field. But I would to make this validation automatic, and for that, I suppose that I need to make generate the javascript by a component. This step gives me some problems.
    Is it possible for a UIComponent to generate Javascript code that will be written at the end of the component?
    Thanks for your help
    Marie.

  • Client side validations

    HI,
    How to perform client side validations?

    Hi
    Its an ADF BC Application.This Screen is used for both Creation and Updations.
    I am having a Text Field(internally AJAX Completion field for auto suggest).
    I want to perform client side validation for it. i.e., If the user is creating a new record it should not be empty.
    First thing I have tried is making the propery 'required' to true. but this created a problem, because if the user is not creating any new record, but just modifying the existing records, then also I get the error message, which actualy should not trigger at all.
    Secondly , I tried to use Validators using method validations.but did not succeed in it. Because , I am not getting how to keep validations for AJax text field( completionField)
    please help.

Maybe you are looking for