I have a page that I want to be refreshed after a user submits a form. I also have another page that I want to be closed after a user submits a form.
How would I go about doing this??
21 17015 gits 5,390
Expert Mod 4TB
could you explain that a bit more? what do you mean with closing a page - do you mean closing a window that displays a page? when you submit what happens then - do you call a php script that you control?
kind regards
I have a popup form that's used to submit comments. When the user clicks the submit button, I'd like the popup window to close once the submission takes place.
gits 5,390
Expert Mod 4TB
just call a js-function onsubmit of your form that uses window.close()
kind regards
just call a js-function onsubmit of your form that uses window.close()
kind regards
Excellent, I'll give that a try
How come if I try to do this:
onSubmit="window.location.reload();" in my form tag it's not submitting the form, it's just refreshing the screen. I want the screen to refresh after the form gets submitted to allow the user to enter a new form without having to jump between screens.
onsubmit is called as soon as the submit button is pressed, not after the submit takes place. Add the refresh to the submitted page instead.
I have the same problem as I want to make the submit button refresh.
I have 3 frames on my page and need the page to refresh after a submit button is pressed for its changes to take effect (change style sheet)
However using
<input type="submit" onSubmit="window.location.reload();" value="Go">just submits and does not refresh.
I am using the http://php.about.com/od/finishedphp1...s_switcher.htm script.
Does anyone know how to make the button refresh the page as well?
onsubmit is a form event, not an input button event. In any case, that wouldn't work either. I assume the form is in a frame and the form submits to the same frame. What you'd need to do is refresh the whole page after the page has been submitted.
Yes, I don't want my visitors to have to manualy do that.
I was thinking of putting js into my cookie.php which is what the form is linked to.
But don't know what to add?
You'd need to reference the parent using 'parent' or 'top' and then reload. It is possible to change styles without reloading the page. One other thing: if possible, try to avoid frames.
I tried targeting it with _Parent but it just loaded the same frame in the frame that was suppost to refresh.
Do you only want to reload one frame or the page which contains the 3 frames?
just 1 other frame would do, but either. If its possible to reload the whole page then i'd prefer that.
To access the parent (the page containing the frames) and reload it: - parent.location.reload();
You would call this after page load in one of the frames. Is there any particular reason why you're using frames?
Where would I put that thought.
Its part of the design.
You can put it in the form action page: - window.onload = function() {
-
parent.location.reload();
-
}
Thank you very much.
Thats the one.. nearly, as this runs the whole page in a loop :P
I just added
So the whole code reads -
window.onload = function() {
-
parent.framename.document.location.reload();
-
}
-
Once again, thank you very much for your help, I do appreciate it. :)
The only problem I have is that it makes the target frame a bit jumpy when it loads as it has to load twice the first time round (initial load, and refresh).
So is it possible to only run the script when the button is submitted?
I have tried the following but it did not work. -
<input type="submit" value="Go" onSubmit="parent.framename.document.location.reload();">
-
Use PHP code to decide if the code should exist. Only have the JavaScript code run if the form has been submitted, e.g. - <?php
-
if (isset(...)) {
-
?>
-
<script type="text/javascript">
-
...
-
</script>
-
<?php
-
}
-
?>
It does not refresh when clicked, what have I done wrong?
This is the code in the form frame. -
<?php
-
if (isset($var)) {
-
?>
-
<script type="text/javascript">
-
$var window.onload = function() {
-
parent.frameName.document.location.reload();
-
}
-
</script>
-
<?php
-
}
-
?>
-
No, it doesn't quite work like that. You need to replace $var with the posted variable in PHP, e.g. $_POST['submit']. Also remove $var on line 5. If you have any more problems on that front, ask in the PHP forum.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Martin the Mac Addict |
last post by:
Good evening to the skilled Ladies and Gentlemen of the PHP world. I
am fairly new to all of this but learning quickly. I have run in to a
need to remove blank lines from a form submission after...
|
by: ratlhead |
last post by:
Hey all,
I'm attempting to do some form processing on a server that has
register_globals off, however, I've run into a confusing situation and
need some help.
Basically, the form is a...
|
by: Chris Smith |
last post by:
Good morning,
Is there a good way to use JavaScript to send a form submission, but get
back the response as a string, rather than loading it into a page? I
could write the code to send the...
|
by: Jim Little |
last post by:
Hello,
I'm driving myself crazy either because I'm missing something about ASP.NET,
or what I'm trying to do simply can't be done.
First, I am not using session variables to track state. My...
|
by: kschneider |
last post by:
Assume there's a form with it's action attribute all set to post to a
URL, but without a submit control. Form submission is done via a link
and I want to prevent the classic "double submit"....
|
by: Oleg Konovalov |
last post by:
Hi,
I have a Java/JavaScript GUI application where I perform a lot of long DB
operations
, which takes 5-60 secs to perform.
Sometimes user double-clicks the button or just gets impatient and...
|
by: Homer |
last post by:
Hi,
I just got a requirement from my HR department to automate their form
submission process and integrate it into the Intranet project that I
had just completed Phase 1 of. Because of the...
|
by: rn5arn5a |
last post by:
Nowadays, most websites make use of CAPTCHA to prevent automated Form
submission. Can someone please give me examples of how automated Form
submission can be achieved?
It's not that I intend to...
|
by: Stanimir Stamenkov |
last post by:
I have a form without a submit button like:
<form name="form1" action=""
onsubmit="alert('submit ' + this.name);">
<div>
<label>Field 1: <input type="text" name="field1"...
|
by: Thekid |
last post by:
I'm trying to auto send a form submission to a website but it isn't working. I've done this before and it worked but for some reason, using the same basic code, it doesn't seem to submit it. I'm...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |