The mechanism you are suggesting is going to involve a page refresh in order to reach the server so why not submit the form and do your validation in the form listener.

The only way you could do this validation on the serverside without a page refresh, which is I guess what you are hoping for, is to use AJAX along with some javascript to obtain the username the use has entered.

I cannot see any advantage in using the @DirectLink to do this (but then again that could just be my opinion). As outlined in my first response you problem with the @DirectLink parameter is the time when it obtains its parameter and at that point the username has not been entered.

Paul


Ananya Goswami <[EMAIL PROTECTED]> wrote:

Thanks a lot for replying!!
                But I think you understood my problem partially. I already
have a listener to check username on submit of the form( which is
server-side validation).But I want to send the username value in the
directlink (which has a listener method ) before submitting the form.


Thanks & Regards
-----------------------------
Ananya Goswami
Software Developer

-----------------------------
mail: [EMAIL PROTECTED]
mob: 09886886320
ph: 080-57561000
extn:3720



-----Original Message-----
From: seloha . [mailto:[EMAIL PROTECTED]
Sent: 12 October 2005 18:30
To: [email protected]
Subject: RE: passing parameters in DirectLink

I think what you want is a @TextField component inside a @Form with a submit

button. So your .html file would look something like this:

<form jwcid="[EMAIL PROTECTED]" listener="listener:checkUniqueUser">
 <input type="text" jwcid="@TextField" value="ognl:username" size="30"/>
 <br/>
 <input type="submit" value="Login"/>
</form>

your .java page would look something like:

public abstract String getUserName();

public void checkUniqueUser(IRequestCycle cycle,String username) {
                String name = getUserName();
                System.out.println("Username="+username);
           return;
         }
         return;
   }

The problem with your code is that the time at which the @DirectLink
parameters are obtained, which is when the server renders the page to
display it. At this point the parmeter username is null.

For further info see the @TextField component documentation.

Hope this helps,

Paul


Ananya Goswami <[EMAIL PROTECTED]> wrote:

Hi All!
        Kindly help me if anybody can..
        I have a .html file where I have a username text field. I have a
link near that to check the uniqueness of the username.
        I have done something like this but am facing a problem in passing
the parameter "username" in the DirectLink.

        .html

<td><input type="text" jwcid="username" size="30"/></td>
<td><a href="#" jwcid="@DirectLink" listener="listener:checkUniqueUser"
parameters="ognl:username"><font color="white" size="4" ><u>Check uniqueness
</u></font></a></td>

         In .java I have a listener method ChequeUniqueUser. I am trying to
print the username to see if I am getting it or not... but am not getting
it!!

public void checkUniqueUser(IRequestCycle cycle,String username) {
                String name = username;
                System.out.println("Username="+username);
           return;
         }
         return;
   }









Thanks & Regards
-----------------------------
Ananya Goswami
Software Developer

-----------------------------
mail: [EMAIL PROTECTED]
mob: 09886886320
ph: 080-57561000
extn:3720



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to