You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sajidbigler <sa...@gmail.com> on 2009/03/04 10:33:09 UTC
Ajax functinality works but how to pass parameter to the request ?
Hi Friends,
I tried to check whether the user is available or not by using ajax
funtionality as shown below
In action i get parameter "id" but not "username" and i want a event to be
fired onblur to a testfield and using the textfield data i want to check
availability if the user does't exists in database then i want him to go to
next field to do entry and if the user exists in database then i need to
restrict him by asking him to select another username by clearing the
textfield.please help me to accomplish this
<script type="text/javascript">
dojo.event.topic.subscribe("/after", function(data, request, widget){
alert('inside a topic event. after request');
//data : text returned from request
//request: XMLHttpRequest object
//widget: widget that published the topic
});
</script>
<s:url var="ajaxTest" includeParams="all" value="/AjaxTest.action">
<s:param name="id" value="%{'22'}" />
<s:param name="username" value="%{username}" />
</s:url>
<sx:bind id="ex4" href="%{#ajaxTest}" sources="username" targets="username"
events="onblur" afterNotifyTopics="/after" />
<s:textfield label="User Name" name="username" required="true"
requiredposition="left" id="username" />
public class AjaxTestForUserNameAvailability extends ActionSupport{
private String username;
private boolean exist;
public String execute(){
if(this.getUsername().equals("Admin")){
this.setExist(true);
}
else{
this.setExist(false);
}
return SUCCESS;
}
}
--
View this message in context: http://www.nabble.com/Ajax-functinality-works-but-how-to-pass-parameter-to-the-request---tp22326366p22326366.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org