jquery form with dialog ( issue with the if else loop in jquery)

Hi have a form to submit with the help of jquery plugin "openid".now every thing works fine when i click on google_button but when i click on aol it will open dialog and will submit the form (when form.submit with return false is commented out) . when i remove the comments the aol will work fine with only aol dialog getting open and form not getting submitted but google form will also will not be submitted in that case.

Please help me out

================================================================================

<form action="example.php" method="post" >   
<input type="image" src="images/google_button.png" id='https://www.google.com/accounts/o8/id' class="google"/> 
          <input type="image" src="images/AOL_button.png" id='http://openid.aol.com/' class='aol' />
</form>

================================================================================

 <script type="text/javascript">  
      $(document).ready(function(){
        $('form').openid(); 
      })
    </script>

================================================================================

(function($){
  $.fn.openid = function() {
    $('input').click(function(e){
      var provider = $(this).attr('class');
     if (provider == 'aol') {
        $("#dialog").dialog();
         /*$('form').submit(function(){
             return false;   
    })*/
     }
     else{
      var provider_url = $(this).attr('id');  //get id
      var myinput = $('<input type="hidden" name="provider_url"/>').val(provider_url);
      $('form').append(myinput);
      $('form').submit();
    }  
    })
  }
})(jQuery);

===============================================================================

Answers


Try to send the form after if else construction.


(function($){
  $.fn.openid = function() {
    $('input').click(function(e){
      var provider = $(this).attr('class');
     if (provider == 'aol') {
        $("#dialog").dialog();
         /*$('form').submit(function(){
             return false;   
    })*/
  ***return false;***   //add return false in this section
     }
     else{
      var provider_url = $(this).attr('id');  //get id
      var myinput = $('<input type="hidden" name="provider_url"/>').val(provider_url);
      $('form').append(myinput);
      $('form').submit();
    }  
    })
  }
})(jQuery);

Need Your Help

get touchstart coordinate on current element

javascript html html5

So I have an element that looks like this:

How do you build a site that scrolls vertically in one div but horizontally only in a child div?

jquery html css layout scroll

I need to have a site where left (red) column is static, full height and not moving and the right column (the blue and green together) scrolls vertically and last that the bottom right(green) section

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.