Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Document to Document control 1

Status
Not open for further replies.

lakeside12

Programmer
Apr 20, 2009
43
CA
Hello
Thank you for all your help and patience with me as a newbie, I am very very grateful

ok
I have a javascript function called update(); in FORM_A.html

The user has hit the submit button on FORM_A.html and is now on FORM_B.html

So there are 2 windows open FORM_A.html & FORM_B.html

QUESTION:

How do I now run function Update() which is in FORM_A.html and have it affect only FORM_A.html. lets say it was a refresh function, and I only want to refresh FORM_A.html

Any help would be greatly appreciated
Many Thanks
 
That will depend on how Form B was opened. If you used something like window.open then FormB's window is a child of FormA's and can address its parent.

window.opener.functionname();

This will execute the function within the parent's scope.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Hi

Thanks for reply, I am not sure if it is a child window, Form_A.html is a standard html form with
Code:
<form name='frm'   target=_blank action="[URL unfurl="true"]https://www....>[/URL]
...
...
....and a submit button
<input type="image" value="Send" src="[URL unfurl="true"]https://www.xyz.jpg">[/URL]

Can you advise me as I am nit sure if this is a child or just another form

Many thanks
 
Yeah that should work too. You can address the FormA from FormB like above.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Hi

Thanks for your reply, ok I got a message in the browser (bottom left icon) that says Permission denied.

The function I am trying to run in Form_A.html basically reloads the form URL

Code:
	   window.location.replace('[URL unfurl="true"]http://www.newurlhere')[/URL]

It is still in the same website, I just need to change the contents of the window. Basically when Form_A.html gets submitted successfully I want to change the contents of that window even though the user has now progressed to form_B.html. I was hoping replace URL would do the trick as it looks very easy and simple to implement.

Please advise if there is a way around the permission issue or a simple way to change the URL of the Window in Form_A.html from Form_B.html

Many thanks
 
I don't get any such an error in FF nor IE8.

Code:
<script>
function myfunc(myParam){
window.location.replace('[URL unfurl="true"]http://www.server.com/windowa.html');[/URL]
}
</script>

and in form B

Code:
<script>
function call_func_from_winA(param){
window.opener.myfunc(param);
}
</script>

Is there any other code that may be changing the page formA is in?



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Hi,
Thanks for your reply and for testing it, I did get it to work as well by putting the code in Form_A.html and and executing the function on the MouseUpEvent works perfectly in IE but surprisingly not in FF I did see an error message in that shield very bottom left and it said:

Message: 'window.opener' is null or not an object
Line: 339
Char: 1
Code: 0
URI:

this is my code is there a mistake in it you can see

Code:
<script type="text/JavaScript">
	function loadnewform()
	 {
	  var MyURL = "Form_A.html?zipcode=" ;
   	  MyURL = MyURL + document.getElementById("zipcode").value ;	
	  window.location.replace(MyURL )
	 }
</script>

Many Thanks
 
1. Where is the loadnewform() function located? In the page with FormA or FormB?

2. How are you calling this function?

Show me a bit more code, than isolated snippets, as it makes it hard to understand the flow.





----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top