Question:

Passing values from pop up window to specific page.....

by  |  earlier

0 LIKES UnLike

hi goodpeoople!

i've a pop up window and inside of it is a form, a form have 2 values and that values need to be pass in a specific page but not in a pop up window..

but my problem is, the value inside my form that im going to pass will never be retreive in test.php page...

below is my code:

<form name="reg_form" method="post" action="test.php" onSubmit="return val_reg_form()">

<input type="checkbox" name="termsCondition" value="Agree"/>

<input type="submit" id="submit" value="Create" name="finish"/>

</form>

then my javascript code:

function val_reg_form ( )

{

var frm=document.reg_form;

valid = true;

<!-- For login validation -->

if(!frm.termsCondition.checked)

{

frm.termsCondition.focus();

valid= false;

alert('Please Read the Terms and Conditions and check the box');

}

else{

window.opener.location.href = "test.php";

window.close();

}

return valid;

}

any idea guyz??

i really appreciate if you have..thankz

 Tags:

   Report

1 ANSWERS


  1. Since I don&#039;t have all of your code, I can&#039;t test this, but the model of actions is:

    &lt;form&gt;

    &lt;input type=&quot;checkbox&quot; name=&quot;termsCondition&quot; value=&quot;Agree&quot; /&gt;

    &lt;input type=&quot;button&quot; id=&quot;submit&quot; value=&quot;Create&quot; onclick=&quot;send(this);&quot; /&gt;

    &lt;/form&gt;

    function send( b ) {

    // argument {b} is a reference to the button

    // get reference to button&#039;s parent form

    var f = b.parentNode;

    // get reference to checkbox by name

    var agree = f.termsConditions;

    // determine checked state of checkbox

    var valid = agree.checked;

    if( valid ) {

    // get the values you want to send to your test.php

    var values = getValuesToSend();

    // send the parameterized URL to the parent window

    window.opener.location.href = &#039;test.php&#039; + &#039;?&#039; + values;

    window.close();

    else {

    agree.focus();

    alert(&#039;Please Read the Terms and Conditions and check the box&#039;);

    }

    }

    function getValuesToSend() {

    // do whatever logic is required to fetch the values

    // to be sent from the popup window to test.php here

    // format the data as key/value pairs expressed in the format:

    // key1=value1&amp;key2=value2 and explicitly return the string to

    // to the calling function - note the &amp; delimiter

    return stringOfKeyValuePairs;

    }

    In your test.php, capture the location object&#039;s href and parse

    it for the parameters, examining them for the key/value pairs

    that represent your data.

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions