This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem accessing the form object of a different frame

 
T Zaman
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi , I would like to submit the form of an external webpage using frame. I have two frame, top frame has the button . If I click that button I want to call the submit action on a form(the form is logging in the user ) which is calling different webpage. I am posting my code. Please let me know is this possible using java script or I should take different approach such as JSP or AJAX? If I take different approach like Jsp or Ajax, then how should I do that and if I can use java scipt then what is the problem here or what should I do here . Please Help



 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you should use Window.parent instead of using parent directly. Also location.src is not a property I think (It is an attribute of frame tag). So you can either use the src property on the frame or href on the location of the frame. Also I think changing the location of a frame will be asynchronous. So in the code



The code after the href statements will be executed even if the page https://gx-support.sun2.lightsurf.net is not loaded completely. Lastly if that page seems to have just a simple form with handler (with the value adminLoginWithPassword), login and password fields. The form points to /authenticate so instead of doing all this mess, you can directly point your frame to https://gx-support.sun2.lightsurf.net/authenticate?handler=adminLoginWithPassword&login=xxx&password=yyy or you can make an ajax request, sending the parameters as request body. I hope I've not misinterpreted anything ...
 
T Zaman
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ankit for the advise. I will sure try that. I dont want to point the frame directly like this "https://gx-support.sun2.lightsurf.net/authenticate?handler=adminLoginWithPassword&login=xxx&password=yyy" as I want to automate the login . I will try using Ajax.thanks a lot for the advise

Ankit Garg wrote:I think you should use Window.parent instead of using parent directly. Also location.src is not a property I think (It is an attribute of frame tag). So you can either use the src property on the frame or href on the location of the frame. Also I think changing the location of a frame will be asynchronous. So in the code



The code after the href statements will be executed even if the page https://gx-support.sun2.lightsurf.net is not loaded completely. Lastly if that page seems to have just a simple form with handler (with the value adminLoginWithPassword), login and password fields. The form points to /authenticate so instead of doing all this mess, you can directly point your frame to https://gx-support.sun2.lightsurf.net/authenticate?handler=adminLoginWithPassword&login=xxx&password=yyy or you can make an ajax request, sending the parameters as request body. I hope I've not misinterpreted anything ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic