#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Posts
    2
    Rep Power
    0
    Hi there!

    I’m not quite used to doing javascript, normally I’m working with PHP, but now I would like to do client sided input check. Please forgive me if my English is a little poor.

    My question is this
    I have a page with two frames; the left frame has an input form which I validate using javascript, the validation starts by the press of a button named “draw”. The right frame is supposed to display some graphics generated by php, on the basis of the parameters in the javascript.

    What I would like is to call the php script by the press of the “draw” button if the input validation is ok. All I’m missing is calling the php script with the parameters from the form and display it in the right frame.

    Something like this:

    If (inputCheckOk)
    {
    (“display graphics in right frame based on parameters P1,P2….Pn”)
    }

    I hope this is enough information, and that someone out there will help a javascript amateur!

    Mads Hemmingsen
    Denmark
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2001
    Location
    UK
    Posts
    527
    Rep Power
    14
    My suggestion would be this. Put a form in the right hand frame. This should be identical the the input form in the left hand frame but make each input of type Hidden.


    <form name="form2" action="yourphpscript.php">
    <INPUT TYPE=HIDDEN NAME="H1">
    <INPUT TYPE=HIDDEN NAME="H2">
    <INPUT TYPE=HIDDEN NAME="H3">
    </Form>

    In the left-hand frame after your validation script add code like this to fill each of the hidden inputs in the right-hand frame with the corresponding values from the left.

    If the left hand form is form1 :

    parent.frames[1].form2.H1.value=parent.frames[0].form1.H1.value;
    parent.frames[1].form2.H2.value=parent.frames[0].form1.H2.value;

    etc.

    this copies all your values from the left hand frame form to the right hand frame form. When you have done this submit the form2.

    parent.frames[1].form2.submit();

    This will send your parameter to your php script and load it into the right-hand frame.

    The other way would be to construct a query string from the form parameters using javascript eg. "H1=whatever&H2=something&H3=1234" and then append this to your script url.

    parent.frames[1].location="yourscript.php?H1=whatever&H2=something&H3=1234";

    John
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Posts
    2
    Rep Power
    0
    Thanks a lot John!

    That really helped me, i was totally stuck

    Mads

IMN logo majestic logo threadwatch logo seochat tools logo