Author: scottbw
Date: Sat Mar  5 20:13:49 2011
New Revision: 1078341

URL: http://svn.apache.org/viewvc?rev=1078341&view=rev
Log:
Fix for WOOKIE-169. The bug was caused by the script only listening to keyup 
events - the auto-complete function in the browser doesn't trigger it, but does 
trigger the change() event, so I've bound the validation action to both events. 
(Note:I also changed the input type to "email". This doesn't really make any 
difference except to iPhone and Opera users, who get a nicer interface)

Modified:
    incubator/wookie/trunk/WebContent/webmenu/requestapikey.jsp

Modified: incubator/wookie/trunk/WebContent/webmenu/requestapikey.jsp
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/webmenu/requestapikey.jsp?rev=1078341&r1=1078340&r2=1078341&view=diff
==============================================================================
--- incubator/wookie/trunk/WebContent/webmenu/requestapikey.jsp (original)
+++ incubator/wookie/trunk/WebContent/webmenu/requestapikey.jsp Sat Mar  5 
20:13:49 2011
@@ -48,24 +48,28 @@ if (version==null){
                document.requestkeyform.submit();       
        }
        
-       $(document).ready(function() {           
-               $("#email").keyup(function(){
-                       var email = $("#email").val();           
-                       if(email != 0){
-                               if(isValidEmailAddress(email)){          
-                                       $("#validEmail").css({ 
"background-image": "url('../shared/images/validyes.png')" });
-                                       isValidEmailAddressFlag = true;         
 
-                               } 
-                               else {           
-                                       $("#validEmail").css({ 
"background-image": "url('../shared/images/validno.png')" });
-                                       isValidEmailAddressFlag = false;        
         
-                               }                        
+       function validate(){
+               var email = $("#email").val();           
+               if(email != 0){
+                       if(isValidEmailAddress(email)){          
+                               $("#validEmail").css({ "background-image": 
"url('../shared/images/validyes.png')" });
+                               isValidEmailAddressFlag = true;          
                        } 
                        else {           
-                               $("#validEmail").css({ "background-image": 
"none" });            
-                       }
-               });
+                               $("#validEmail").css({ "background-image": 
"url('../shared/images/validno.png')" });
+                               isValidEmailAddressFlag = false;                
 
+                       }                        
+               } 
+               else {           
+                       $("#validEmail").css({ "background-image": "none" });   
         
+               }
+       }
+       
+       $(document).ready(function() {           
+               $("#email").change(validate);
+               $("#email").keyup(validate);
        });
+       
 
        function doDialog(){
                $("#confirm").dialog({
@@ -123,7 +127,7 @@ if (version==null){
 <tr class="ui-widget-header"><td 
colspan="2">&nbsp;<%=localizedMessages.getString("webmenu.requestapikey.4")%></td></tr>
 <tr>  
   <td><%=localizedMessages.getString("webmenu.requestapikey.7")%></td> 
-  <td><input style="float:left;" name="email" size="50" type="text" id="email" 
value=""><div id="validEmail"></div></td>
+  <td><input style="float:left;" name="email" size="50" type="email" 
id="email" value=""><div id="validEmail"></div></td>
 </tr>
 <tr>  
   <td colspan="2" align="center">


Reply via email to