Re: Ref: Embed a form within a form

From: Date: Sun, 10 Mar 2013 19:42:56 +0000
Subject: Re: Ref: Embed a form within a form
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-320450@lists.php.net to get a copy of this message
On 3/10/2013 1:13 PM, John Taylor-Johnston wrote:
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>
A div in a table cell?  What does that buy you over a the id on the input element?


« previous php.general (#320450) next »