struts javascript validator message problem

Discussion in 'Java' started by Alex M, Feb 23, 2004.

  1. Alex M

    Alex M Guest

    I'm trying to use the jakarta struts client side javascript validators
    and the validators are working, but they are not showing the popup
    messages. I have the message keys defined in the
    ApplicationResources.properties file, the propertise file is in the
    right location, it is referenced from the struts-config.xml, but still
    no messages. For example, submitting a form that violates the
    required field validator, just causes it to do nothing but shift focus
    to that field, no messages are shown.

    Am I missing something?
    Alex M, Feb 23, 2004
    #1
    1. Advertising

  2. Alex M wrote:
    > I'm trying to use the jakarta struts client side javascript validators
    > and the validators are working, but they are not showing the popup
    > messages. I have the message keys defined in the
    > ApplicationResources.properties file, the propertise file is in the
    > right location, it is referenced from the struts-config.xml, but still
    > no messages. For example, submitting a form that violates the
    > required field validator, just causes it to do nothing but shift focus
    > to that field, no messages are shown.
    >
    > Am I missing something?


    javascript? This is the java newsgroup - try posting that to
    comp.lang.javascript instead.
    Peter Astbury, Feb 24, 2004
    #2
    1. Advertising

  3. Alex M

    Matt Parker Guest

    Peter Astbury wrote:

    > Alex M wrote:
    >> I'm trying to use the jakarta struts client side javascript validators
    >> and the validators are working, but they are not showing the popup
    >> messages. I have the message keys defined in the
    >> ApplicationResources.properties file, the propertise file is in the
    >> right location, it is referenced from the struts-config.xml, but still
    >> no messages. For example, submitting a form that violates the
    >> required field validator, just causes it to do nothing but shift focus
    >> to that field, no messages are shown.
    >>
    >> Am I missing something?

    >
    > javascript? This is the java newsgroup - try posting that to
    > comp.lang.javascript instead.


    He is right to post here, this is a Struts question. As it is, I don't know
    the answer since I've only used the server-side validator component, not
    the client-side component. Maybe someone else will have an idea.

    OS, browser etc would be some useful information...

    Matt

    --
    Not so interesting...
    http://www.mpcontracting.co.uk
    Matt Parker, Feb 24, 2004
    #3
  4. Alex M

    Ryan Stewart Guest

    "Alex M" <> wrote in message
    news:...
    > I'm trying to use the jakarta struts client side javascript validators
    > and the validators are working, but they are not showing the popup
    > messages. I have the message keys defined in the
    > ApplicationResources.properties file, the propertise file is in the
    > right location, it is referenced from the struts-config.xml, but still
    > no messages. For example, submitting a form that violates the
    > required field validator, just causes it to do nothing but shift focus
    > to that field, no messages are shown.
    >
    > Am I missing something?


    Do you have all the javascript elements and files in the proper places? I'm
    learning Struts now and just tinkered with that feature yesterday. If you
    look at the example application that comes with it, you'll see an example of
    Javascript validation in their logon.jsp. First of all, the Javascript
    itself is specified in validator-rules.xml. You need an <html:javascript>
    tag in the file where you want to do the validation as well as a script tag
    to include an external js file, staticJavascript.jsp (that's their name for
    it). See the example app for this file's contents (it's tiny, not sure how
    it does what it does yet). Finally, in the form you want to validate add to
    the form tag:
    onsubmit="return validateLogonForm(this);"

    Or whatever function you want to call. I think that's everything.
    Ryan Stewart, Feb 24, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hari Om
    Replies:
    3
    Views:
    12,106
    Wendy S
    Oct 1, 2003
  2. matt hegarty
    Replies:
    0
    Views:
    604
    matt hegarty
    Apr 5, 2004
  3. Joos Nielsen
    Replies:
    2
    Views:
    1,010
    Ryan Stewart
    Jun 4, 2004
  4. Dom
    Replies:
    4
    Views:
    1,746
    Andrew Thompson
    Sep 1, 2004
  5. Replies:
    4
    Views:
    884
    Richter~9.6
    Feb 13, 2007
Loading...

Share This Page