Ref: Embed a form within a form

[email protected] (John Taylor-Johnston)
Newsgroups php.general
Message-ID <[email protected]>
I asked a question about embedding a form within a form, which I 
realised after was out of the bounds of PHP.
I also asked if PHP could help me open a form in another window. ... 
Sometimes PHP can do magic things, but not that.

However, for anyone wondering, it is possible to do both. This is what I 
have come up with using jquery:

I didn't need to create an extra parent DIV and name it id="place_here". 
Naming a table cell id="place_here" and making it the parent to DIV 
id="div_2" was enough.
This is a brilliant little work around. Works in Firefox and IE.

     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"DTD/xhtml1-strict.dtd">
     <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" 
lang="fr"><head>
     <title>test / crtp</title>

     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     <script type="text/javascript" src="jquery.js"></script>

     <script type="text/javascript">
     $(document).ready(function () {
         position_mdiv()();
         $(window).resize(function() {
             position_mdiv();
         });
     })

     function position_mdiv(){

         var pos = $('#place_here').position();
         var width = $('#place_here').outerWidth();

         $('#div_2').css({
         position: "absolute",
         top: pos.top +2 + "px",
         left: (pos.left -300 + width) + "px"
     });

     }

     </script>
     <body>

     <form id="CTRP_Form">
     <table border="1">
     <tr>
     <td>
     <div id="div_1"><input id="fnam" name="fnam" form="CTRP_Form" 
type="text"><input type=submit></div>
     </td>
     <td id="place_here" 
style="background:yellow;width:300px;padding:0px;border:solid 2px 
#CCC"></td>
     </tr>
     </table>
     </form>


     <div id="div_2"><form id="query_Form" 
target="_somewhereelse"><input id="MyQuery" name="MyQuery" 
form="query_Form" type="text"><input type=submit></form></div>

     </body>
     </html>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.