0

I have made a form. I want to open a inline popup on submit and make a text box in the popup that is compulsory to be filled and then in the popup when the user submits a form, the form then gets submitted via popup and page gets refreshed.

I am not able to show alert box in the popup and submit the form via popup.

<script type="text/javascript">
$(document).ready(function() {

  $("#submit").click(function(){
    $(".variousz").trigger('click');

  });

$(".variousz").fancybox({
    maxWidth    : 800,
    maxHeight   : 600,
    fitToView   : false,
    width       : '70%',
    height      : '70%',
    autoSize    : false,
    closeClick  : false,
    openEffect  : 'none',
    closeEffect : 'none',
    afterClose: function(){
         $('#formsubmit').submit();
        }

});
$("form").submit(function() {
 if ($('#accept').val() == 'ACCEPT'){ } else { $("span").text("Query is Not valid!").show().fadeOut(1000);
 return false; }
});
});
</script>
<body>

    <div id="inline" style="display:none;width:500px;">
        <h2>Lorem ipsum dolor sit amet</h2>     
        <p>
            <input type="text" name="accept" id="accept" value=""><span></span>

        </p>
        <p>
            Lorem ipsum dolor sit amet, consectetur adipiscing elit.
        </p>
    </div>  
    <div class="tab_container">
            <a style="display:none;" class="variousz" href="#inline">Inline</a>

            <form method="GET" action="test.html" id="formsubmit" onsubmit="test.html" >
            <input type="text" name="aaa">
            <input type="button" id="submit" value="submit"> 
            </form>
    </div>
user930026
  • 1,647
  • 5
  • 34
  • 59

1 Answers1

1

There are several popup plugins over here. http://choosedaily.com/1178/15-jquery-popup-modal-dialog-plugins-tutorials/
And implement them with your form.
This old example is a good one too And all the colorbox,fancybox Other light box alternatives like these might be handful.

And there is an other stack overflow question exactly same as this. Thank you

Community
  • 1
  • 1
Katti
  • 2,013
  • 1
  • 17
  • 31