struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sajidbigler <sajidbig...@gmail.com>
Subject Ajax for username availability
Date Tue, 03 Mar 2009 09:28:02 GMT

Do you have an example of ajax as taking textfield like username  and
invoking action to check whether the username is available or not and if
available ask user to enter another username or make the same filed empty

i tried to accomplish this by folowing

<script type="text/javascript">
   dojo.event.topic.subscribe("/after", function(data, request, widget){
   var username=dojo.widget.byId('username');
   username.innerHTML = "";
      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" value="/AjaxTest.action" />
		<tr>

			<td>*<s:text name="label.username"></s:text></td>
			<td><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" /></td>
		</tr>

how can we can write action class which implements to take data from UI of
perticular field and check and return respose ?
-- 
View this message in context: http://www.nabble.com/Ajax-for-username-availability-tp22305157p22305157.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


Mime
View raw message