SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
Thread: Form validation pop up?
Hybrid View
-
Jul 20, 2008, 14:20 #1
- Join Date
- Dec 2007
- Posts
- 206
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Form validation pop up?
I have a long page on my site, and if some1 were to fill out my form wrong or correctly and press submit, the site will refresh and goto the very top of the page. My form and error/thank you message are at the bottom of the page by my form so they wouldnt be visible. Is there anyway to make the fom error/thanks div visible as a popup msg? I'm using lightwindow for images and it also works for pages. Don't know if it's possible or not to use this as the way the image is displayed, but heres a link to its examples here.
If that isn't possible, is there a way to stop the browser from resetting all the way to the top of my page?
If both of them dont work, any1 have a suggestion?
-
Jul 20, 2008, 18:33 #2
- Join Date
- Jan 2007
- Location
- Christchurch, New Zealand
- Posts
- 14,729
- Mentioned
- 104 Post(s)
- Tagged
- 4 Thread(s)
If you have an identifier on the error or thanks, you can use the fragment identifier to make the page jump down to there.
Code javascript:<div id="formMessage"> ... </div>
and navigate to page.html#formMessageProgramming Group Advisor
Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
Car is to Carpet as Java is to JavaScript
-
Jul 20, 2008, 20:07 #3
- Join Date
- Dec 2007
- Posts
- 206
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
how do I do that after the submit button is pressed and the page reloads though? wherre would i place it?
-
Jul 20, 2008, 20:40 #4
- Join Date
- Jan 2007
- Location
- Christchurch, New Zealand
- Posts
- 14,729
- Mentioned
- 104 Post(s)
- Tagged
- 4 Thread(s)
That depends on how the form action is occuring.
If the form is going back to the same page you should be able to add #formMessage to the end of the action attribute.
Code html4strict:<form method="post" action="form.php#formMessage"> ... </form>
Programming Group Advisor
Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
Car is to Carpet as Java is to JavaScript
-
Jul 21, 2008, 16:36 #5
- Join Date
- Dec 2007
- Posts
- 206
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
its a php form, so i have this
Code php:<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
but in my browser it comes up as this
Code:<form action="/redo/index.php" method="post">
Code:<form action="/redo/index.php#contactform" method="post">
-
Jul 21, 2008, 17:22 #6
- Join Date
- Jan 2007
- Location
- Christchurch, New Zealand
- Posts
- 14,729
- Mentioned
- 104 Post(s)
- Tagged
- 4 Thread(s)
<form action="<?php echo $_SERVER['PHP_SELF'];?>#contactform" method="post">
Programming Group Advisor
Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
Car is to Carpet as Java is to JavaScript
-
Jul 21, 2008, 18:30 #7
- Join Date
- Dec 2007
- Posts
- 206
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
thx! worx perfectly
Bookmarks