PDA

View Full Version : check textfield in an iframe



l_kris06
02-05-2009, 08:22 PM
Hi all,

I have an page with an iframe, and the iframe src file has few textfields and i want to get at that. how do i get its values?

for example:

page A:

<html>
<head>
<script type="text/javascript">
<!--
function convertText() {
document.SampleForm.myText.value = document.SampleForm.myText.value.toUpperCase()
}
-->
</script>
</head>
<iframe scrolling="no" src="po.php" name="fr1" id="fr1"></iframe>
</html>


po.php has a textfield[myText]. I want to get at this value. any help would be appreciated it.

Best,
Kris

l_kris06
02-05-2009, 08:45 PM
ok, i made an example code to help me get an understanding. Looks ok, except for one problem. When the user hits submit, the form should do its post. I want to get at the textfield only when the user trys to go to a different page.

This is wht i have so far:


<html>
<head>
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function convertText() {
var x = document.SampleForm.myText.value;
if(x == ""){
alert("Nothin");
}else{
confirm("Unsaved Data");
}
}
-->
</script>
</head>

<body onunload="convertText()">
<form name="SampleForm" action="abc.php">
<input type="text" name="myText">
<input type="submit" value="Convert" >
</form>
</body>
</html>

any help would be great.

Rgds,
Kris