RE: [PHP] How to change value of input on form from iframe?

From: Date: Tue, 15 May 2001 15:03:44 +0000
Subject: RE: [PHP] How to change value of input on form from iframe?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-52871@lists.php.net to get a copy of this message
Try this: window.parent.document.forms["newphone"].operatorid.value=oper_id; You probably need to target the parent window, working with IFRAME is like working with FRAMES. Robert Zwink -----Original Message----- From: Dezider Góra [mailto:gora@wittmann.sk] Sent: Monday, May 14, 2001 8:35 AM To: PHP General Subject: [PHP] How to change value of input on form from iframe? I'm having a big problem. I've created "bound" combo's page, that works. When user selects a value from first combo, second combo in IFRAME is requeried and shows only corresponding values. Now I need to get the value from the second combo back to the main form. I'm trying all javasrcipt combinations that come to my mind, but with no succes. Can PLEASE anybody show me the correct syntax? tia Dezider. the main page: <HEAD> <? echo "<DEFANGED_SCRIPT LANGUAGE=\"JAVASCRIPT\">"; echo "function requery(country_id)"; echo "{"; echo "document.all.operator.src=\"getoperators.php?id=\" + country_id;"; echo "}"; echo "</SCRIPT>"; ?> </HEAD> <BODY> . . . <TD WIDTH="150"><B>Operátor</B></TD> <TD>:</TD> <TD><DEFANGED_IFRAME name="operator" "id="operator" SRC="getoperators.php" FRAMEBORDER=NO SCROLLING=NO HEIGHT="22" WIDTH="200"></IFRAME></td> </TR> <TR> <TD COLSPAN="3"> <INPUT TYPE="HIDDEN" NAME="operatorid" id="operatorid" VALUE="0"> <input type="SUBMIT" value="Send"> </td> </TR> getoperators.php is: <HTML> <HEAD> <DEFANGED_SCRIPT language="Javascript"> function savevalue(oper_id) { alert (oper_id) document.forms["newphone"].operatorid.value=oper_id; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PLEASE how to correct this? } </SCRIPT> </HEAD> <? include "../../include/data_mysql.php"; $objData = new mysql_db; $objData->init(); $sqlstring = "select * from cell_operators where country = $id"; $obj_str = "<SELECT NAME=\"operid\" TABINDEX=\"1\" SIZE=\"1\" style=\"position: absolute; top: 0px; left: 0px\" DEFANGED_OnChange=\"savevalue(this.value)\"><OPTION VALUE=\"0\">nie je</OPTION>"; if ( $objData->query($sqlstring) ): # Create a list from results while ( $objData->movenext() == False ){ $obj_str .= "<OPTION VALUE=\"" . $objData->value( "id" ) . "\">" . $objData->value( "cell_prefix" ) . ' - ' . $objData->value( "description" ) . "</OPTION>"; } endif; $obj_str .= "</SELECT>"; echo $obj_str; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#52871) next »