Ref: Embed a form within a form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux