Monthly Archives: January 2008

Send a post request to a popup

Today i want to send the post request from a form to a pop up window and the solution is pretty simple first we have to create our form and then we add a target attribute where we specify the name that our popup window will have second we add a onsumbit call to the form that will popup the new window and submit the form we also have to assign and id to our form that will be usefull when calling the function that popup the windows

  1.  
  2. "index.php""post""windowName""return postPopup();""postForm"
  3.  "text""value1"
  4.  "text""value2"
  5.  <!– put all the form elements here –>
  6.  "submit"
  7.  
  8.  

  1.  
  2. <script type="text/javascript"// here we popup the new window, the second attribute have to be the same as the form target attribute
  3. , ‘windowName’, ‘width=800, height=400, resizable=yes, scrollbars=yes, toolbar=no, location=no, directories=no, status=no, menubar=no’ );
  4.         // we submit the form 50 milliseconds after so the browser creates the popup
  5.         setTimeout("document.getElementById(‘postForm’).submit();",50);
  6.         // we stop the regurar form submit