Validation on grails submitButton
Is it possible to create a validation using javascript to be implemented on the onCLick property of grails' `<g:submitButton>` tag? I am using a webflow to proceed from one page to another. Here is my code for the Next button:

     <g:submitButton class="btn btn-primary" name="next" value="Next" onclick="return isfilipinoCitizen()"></g:submitButton>  

The isfilipinoCitizen function is found on my javascript code:

                    <script type="text/Javascript">                      
                    function isfilipinoCitizen() {    
                      var selected = "${accountInfo?.filipinoCitizen}";
                          if(selected == "1"){
                              return true;
                          }else{
                              alert(selected)
                              alert("You must be a Filipino citizen to register!")
                              document.location.href = "myhomepage";
                          }
                    }
                    </script>


What I wanted to do here is to prevent the page from proceeding to the next page if the input from the user is 0, and redirect the user to the home page of the system. But it seemed that it doesn't work at all.

Any help from you guys is highly appreciated. 

Thanks!

Validation on grails submitButton
===

Is it possible to create a validation using javascript to be implemented on the onCLick property of grails' `<g:submitButton>` tag? I am using a webflow to proceed from one page to another. Here is my code for the Next button:

     <g:submitButton class="btn btn-primary" name="next" value="Next" onclick="return isfilipinoCitizen()"></g:submitButton>  

The isfilipinoCitizen function is found on my javascript code:

                    <script type="text/Javascript">                      
                    function isfilipinoCitizen() {    
                      var selected = "${accountInfo?.filipinoCitizen}";
                          if(selected == "1"){
                              return true;
                          }else{
                              alert(selected)
                              alert("You must be a Filipino citizen to register!")
                              document.location.href = "myhomepage";
                          }
                    }
                    </script>


What I wanted to do here is to prevent the page from proceeding to the next page if the input from the user is 0, and redirect the user to the home page of the system. But it seemed that it doesn't work at all.

Any help from you guys is highly appreciated. 

Thanks!
