...

View Full Version : how to access value in a textbox in one frame from other in javascript?



phani
08-07-2002, 08:29 AM
how to access value in a textbox in one frame from other in javascript?

glenngv
08-07-2002, 08:45 AM
textboxValue = top.frames["FrameNameHere"].document.formNameHere.textboxNameHere.value

phani
08-07-2002, 09:09 AM
sorry sir, it's not working. it showing an error message saying that

"object does not support this property or method"

textboxValue = top.frames["FrameNameHere"].document.formNameHere.textboxNameHere.value

can u please verify and send me again

phani.

glenngv
08-07-2002, 09:13 AM
did you change the names (in bold) into corresponding ones?

textboxValue = top.frames["FrameNameHere"].document.formNameHere.textboxNameHere.value

please post the exact code you are using.

phani
08-07-2002, 10:03 AM
yes sir i have got it. i have changed the object names before only even though i made a small mistake.

can u help me in coding of java server pages. i have used the following code for "jsp2.jsp"

<html>
<body>
<form name="form1">
<input name=text1 value="hello">

<%
String s=request.getParameter("text1");
out.println(s);
%>
</body>
</html>

when iam running this it is running null value. if i includes the following tag it first returns null after pressing the button it is returning the value. why is it?

<input type=submit onsubmit="jsp2.jsp">

glenngv
08-07-2002, 10:23 AM
you can only request the value of a textbox when the form is submitted.
in your case, when the page first loads, request.getParameter will return null because there is no post/get data submitted, only then when you click submit (which submits to the same page, in your case), request.getParameter("text1") will return its value.

btw, what's the connection of this problem to your javascript problem?

phani
08-07-2002, 10:35 AM
sir, there is no connection between them. this is a different problem iam getting. then how to retrieve a value from a textbox in jsp with recalling the same form

glenngv
08-07-2002, 11:02 AM
there is no JSP forum here....
but i'll answer you just the same.

in your jsp2.asp:

<%
String s=request.getParameter("text1");
if (s==null) s="";
%>
<html>
<body>
<form name="form1" action="jsp2.jsp" method="post">
<input name=text1 value="hello" value="<%=s%>">
<%
out.println("This is what you entered: "+s);
%>
<input type=submit value="Submit">
</form>
</body>
</html>

but going back to your javascript problem, did you solve it using my suggestion?

phani
08-07-2002, 11:55 AM
thank u sir, for u reply. i have solved the javascript problem.
when iam pressing the reply button to send reply for u it is asking to login again even though i have logged in before. why it is so? send the remedy.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum