Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Popup Box for special text field GURU help needed

    I need help from a GURU....

    This opens the pop up box
    Code:
    <form method=post action='' name=state>
    <table border=0 cellpadding=0 cellspacing=0 width=550> <tr>
    <td ><font size=2 face='Verdana'>Your Name</font>
    <input type=text name='p_name' size='8'>
    <a href="javascript:void(0);" NAME="My Window Name" title=" My title here " onClick=window.open("child3.html","Ratting","width=550,height=170,left=150,top=200,toolbar=1,status=1,");>Click here to open the child window</a>
    </td></tr> </table></form>
    This is the child3.html code

    Code:
    <html>
    <head>
    
    <script langauge="javascript">
    function post_value(){
    opener.document.state.p_name.value = document.frm.me.value;
    self.close();
    }
    </script>
    
    <title>(Type a title for your page here)</title>
    </head>
    
    
    <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
    
    
    <form name="frm">
    
          
    <select name="me">
    <option value="AR">AR</option>
    <option value="MN">MN</option>
    <option value="CA">CA</option>
    </select>
    
    
    
    
    <table border=0 cellpadding=0 cellspacing=0 width=250>
    
    
    <tr><td align="center"> Your name
    <input type=button value='Submit' onclick="post_value();">
    </td></tr>
    </table></form>

    Now this works great..... My problem is this... I am sending the info to text box. Which this should work. Except my text name has square brackets...

    Code:
    <input type=text name=c[optional_field_1] value="" size=2 maxlength=2 class=data_field_values>
    Now the ME field I should just have to put in c[optional_field_1] and it should work. I can't rename this field so I have no choice but to find a way for java script to work with it some how....

    My form name is. <form name=registration_form
    text field to send to. c[optional_field_1]

    I plan to have 6 popups using a different field.
    c[optional_field_1]
    c[optional_field_2]
    c[optional_field_3]
    c[optional_field_4]
    c[optional_field_5]
    c[optional_field_6]

    For some reason Java script does not like those SQUARE brackets. I am new. So any help would be great.

    thx...

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Welcome to the Forum.

    javascript likes square brackets, but it likes also you to learn to use it:

    you field must be send to:

    opener.document.forms['registration_form'].elements['c[optional_field_1]']
    or even
    opener.document['registration_form']['c[optional_field_1]']
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    May 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Kor
    Welcome to the Forum.

    javascript likes square brackets, but it likes also you to learn to use it:

    you field must be send to:

    opener.document.forms['registration_form'].elements['c[optional_field_1]']
    or even
    opener.document['registration_form']['c[optional_field_1]']

    I keep getting erros when I try this

    is NULL or not and Object....
    Last edited by geomodules; 05-08-2006 at 10:10 AM.

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Really?
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  "http://www.w3.org/TR/html4/loose.dtd">
    <
    html>
    <
    head>
    <
    title>Untitled Document</title>
    <
    meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <
    meta http-equiv="Content-Style-Type" content="text/css">
    <
    meta http-equiv="Content-Script-Type" content="text/javascript">
    <
    script type="text/javascript">
    onload=function(){
    alert(document.forms['registration_form'].elements['c[optional_field_1]'].value)
    }
    </script>
    </head>
    <body>
    <form name="registration_form">
    <input name="c[optional_field_1]" type="text" value="bla">
    </form>
    </body>
    </html> 
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    New to the CF scene
    Join Date
    May 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I can't get it to work...LOL.... Can you use mine pretty please...

    ********html 1********run this first
    Code:
    <form method=post action='' name=state>
    
    
    
    <table border=0 cellpadding=0 cellspacing=0 width=550> <tr>
    <td ><font size=2 face='Verdana'>Your Name</font>
    
    <input type=text name='registration_form' size='8'>
    
    
    <a href="javascript:void(0);" NAME="My Window Name" title=" My title here " onClick=window.open("child3.html","Ratting","width=550,height=170,left=150,top=200,toolbar=1,status=1,");>Click here to open the child window</a>
    
    
    
    </td></tr> </table></form>

    *****HTML 3 name it to child3.html ****

    Code:
    <html>
    <head>
    
    <script langauge="javascript">
    function post_value(){
    opener.document.state.registration_form.value = document.frm.me.value;
    self.close();
    }
    </script>
    
    <title>(Type a title for your page here)</title>
    </head>
    
    
    <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
    
    
    <form name="frm">
    
          
    <select name="me">
    <option value="AR">AR</option>
    <option value="MN">MN</option>
    <option value="CA">CA</option>
    </select>
    
    
    
    
    <table border=0 cellpadding=0 cellspacing=0 width=250>
    
    
    <tr><td align="center"> Your name
    <input type=button value='Submit' onclick="post_value();">
    </td></tr>
    </table></form>

    Has something to do with the state field....
    Code:
    opener.document.state.registration_form.value = document.frm.me.value;

  • #6
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Make up your mind. You said so:
    My form name is. <form name=registration_form
    text field to send to. c[optional_field_1]
    if so, the reference is
    opener.document.forms['registration_form'].elements['c[optional_field_1]']

    If not, use the correct names of the form and of the text field

    opener.document.forms['yourformname'].elements['yourtextfieldname']
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #7
    New to the CF scene
    Join Date
    May 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Kor
    Make up your mind. You said so:

    if so, the reference is
    opener.document.forms['registration_form'].elements['c[optional_field_1]']

    If not, use the correct names of the form and of the text field

    opener.document.forms['yourformname'].elements['yourtextfieldname']
    I am sorry php is my game. I am so lost... For 3 days I have been trying to make this work. All I want it to do is open a pop window then I select from the drop down box and put it in the text field. The square brackets came back with the errors.... This whole line is needed in order for the pop up to work

    Code:
    opener.document.state.registration_form.value = document.frm.me.value;
    the state field is taken from the 1st page.
    <form method=post action='' name=state>

    I have tried every possible configuration I can think using this but mine has no elelement so I though lets play. I keep moving them around. You seem to understand this very well. Please forgive me if I don't understand. No matter what I do I can't get it to work. Any help can give would be great.

  • #8
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    you need also events:

    .....
    onload=post_value;
    ...
    <select name="me" onchange="post_value()">

    But, for God's sake, tell me which are the names YOU are using in the opener. Meake it clear once for ever.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #9
    New to the CF scene
    Join Date
    May 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok I will explain it the best I can.....


    This is my first html page.... you will see the name state
    Code:
    <form method=post action='' name=state>
    <table border=0 cellpadding=0 cellspacing=0 width=550> <tr>
    <td ><font size=2 face='Verdana'>Your Name</font>
    <input type=text name='registration_form' size='8'>
    <a href="javascript:void(0);" NAME="My Window Name" title=" My title here " onClick=window.open("child3.html","Ratting","width=550,height=170,left=150,top=200,toolbar=1,status=1,");>Click here to open the child window</a>
    </td></tr> </table></form>
    which is calling the child3.html page.....

    Code:
    <html>
    <head>
    <script langauge="javascript">
    function post_value(){
    opener.document.state.registration_form.value = document.frm.me.value;
    
    self.close();
    }
    </script>
    <title>(Type a title for your page here)</title>
    </head>
    <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
    <form name="frm">
    <table border=0 cellpadding=0 cellspacing=0 width=250>
    <tr><td align="center"> Select State
    <select name="me">
    <option value="AR">AR</option>
    <option value="MN">MN</option>
    <option value="CA">CA</option>
    </select>
    <input type=button value='Submit' onclick="post_value();">
    </td></tr>
    </table></form>

    The above works GREAT... just not with c[optional_field_1] because of square brackets.

    So the java code is as follows.
    function post_value(){
    opener.document.state.registration_form.value = document.frm.me.value;
    self.close();
    }

    state being taken from the 1st html page which starts the popup
    registration_form is the name of the form in the 2nd html
    I have me in there because some how I need to change this to c[optional_field_1]


    opener.document.state.registration_form.value = document.frm.me.value;

    I hope I explained it well.....

  • #10
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    once again, WRITE THE NAMES YOU WANT TO USE NOW. Leave me about what it had worked in the past...
    What is so hard to understand, after all? Put your names u want to use in the place of the red italic strings bellow

    document.forms['putherethenameoftheform'].elements['putherethenameofyourelement']
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #11
    New to the CF scene
    Join Date
    May 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Kor
    once again, WRITE THE NAMES YOU WANT TO USE NOW. Leave me about what it had worked in the past...
    What is so hard to understand, after all? Put your names u want to use in the place of the red italic strings bellow

    document.forms['putherethenameoftheform'].elements['putherethenameofyourelement']

    Mine
    opener.document.state.registration_form.value = document.frm.me.value;

    Yours
    document.forms['registration_form'].elements['c[optional_field_1]']


    maybe??
    opener.document.state.['registration_form'].value = document.frm.['c[optional_field_1]'.value;

    I get expected identifier..... *sigh*

  • #12
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Sir you are not attentive at all regarding the syntax. Forms' elements are to be refere in many ways, but don't mixt them

    document.formname.elementname
    or
    document.forms['formname'].elements['elementname']
    or
    document.formname.elements['elementname']
    or
    document.forms['formname'].elementname
    or
    document.forms['formname']['elementname']
    or
    document['formname']['elementname']

    Take care about when and how to use dots and quotes.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #13
    New to the CF scene
    Join Date
    May 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if I do this with it....

    <script langauge="javascript">
    function post_value(){

    opener.document.forms['registration_form'].elements['c[optional_field_1]'].value;


    self.close();
    }


    I comes back with
    opener.document.forms.registration_form.elements is NULL or not and object...

    I'm trying....

  • #14
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Man. let's take from the begining; In the opener you have a form and a textfield

    form name =?
    text field name=?

    In the popup you have a form and a text box.

    form name=?
    text box name =?

    Now, which must be the event in the popup wich will tranfere a value from the textbox in popup to the textfield in the opener?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #15
    New to the CF scene
    Join Date
    May 2006
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Man. let's take from the begining; In the opener you have a form and a textfield

    <form method=post action='' name=state>
    form name = state
    <input type=text name="registration_form" size='8'>
    text field name =registration_form

    In the popup you have a form and a text box.

    <form name="frm">
    form name = frm
    <select name="c[optional_field_1]">
    text box name = c[optional_field_1]

    A drop down box will load with states... they select state and click submit button.

    take from drop down and sent to c[optional_field_1]

    Now, which must be the event in the popup wich will tranfere a value from the textbox in popup to the textfield in the opener?


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •