0 Replies - 1471 Views - Last Post: 20 September 2012 - 03:27 AM

#1 nick2price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 561
  • View blog
  • Posts: 2,826
  • Joined: 23-November 07

Two forms in one

Posted 20 September 2012 - 03:27 AM

Hi guys, this may need php or something else, so feel free to move if appropiate. I have a form (simplified version)
<form id="myform" onsubmit="myform_submit();return false;" action="test" method="post">

  <div id="more">
    <a href="#box" class="login-window">More?</a> 
  </div> 
  
  <div id="name">
    <input name="name2" id="name2" placeholder="Name" type="text" style="width: 183px;text-align:left;float:left;" maxlength="100"/>
  </div>
  
  <div id="telephone">
    <input name="telephone2" id="telephone2" placeholder="Phone" type="text" style="width: 183px; text-align:left; float:left;" maxlength="100"/>
  </div>
  
  <div id="email">
    <input name="email2" id="email2" placeholder="Email" type="text" style="width:183px; text-align:left; float:left;" maxlength="100" />
  </div>
  
  <div  id="title-bottom">
	<input type="submit" class="btn" name="submit" value="Send" />
  </div>
</form>



There are a lot more fields, the above is pretty stripped down. The important part of the form I want to show is the more div. Basically, when clicked, it uses JQuery to load up a modal box which is in essence another form.
<div id="login-box" class="login-popup"> 
<a href="#" class="close"><img src="http://www.example.com/cross.png" class="btn_close" title="Close" alt="Close" /></a>
  <form class="popup" method="post" action="#">
    <div id="leave">
      <input type="text" placeholder="From" class="selector" name="from2" autocomplete="off"/>
    </div>
    
    <div id="where">
      <input type="text" placeholder="To" class="selector" name="where2" autocomplete="off"/>
    </div>
    
    <div id="when">
      <input onclick="javascript: $('#returndate2').show(0);" style="background-color:transparent; border:0; padding:0;" type="radio" name="returntrip2" value="yes" checked="checked"/>
      Return
      <input onclick="javascript: $('#returndate2').hide(0);" style="background-color:transparent; border:0; padding:0; margin-left:5px;" type="radio" name="returntrip2" value="no" />
      Single
    </div>
      
    <div id="date">
      <input type="text" name="departdate2" id="departdate2" class="datepicker" value="leave" />
      <input type="text" name="returndate2" id="returndate2" class="datepicker" value="when" />
    </div>
    
    <button class="submit button" type="button">Add</button>
  </form>
</div>


Basically, my question is, whats the best way to get the data from the modal popup form back to the main form? So when submit is pressed on the popup form, it should take all the inputs and pass them to the main form.

Cheers

Is This A Good Question/Topic? 0
  • +

Page 1 of 1