Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-29-2004, 07:04 AM   #1 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
javascript alert without refreshing?

there is a page that i'm validating server-side.

i am re-populating the form field values with the post data.

if errors are found, i print a javascript alert() with the error.

the problem is, upon pressing 'ok' to the javascript alert, the text in the form fields goes away.

is there anyway to prevent the javascript alert from refreshing the form?
__________________
Mike
sde is offline   Reply With Quote
Old 06-29-2004, 01:11 PM   #2 (permalink)
sammy
Code Monkey
 
sammy's Avatar
 
Join Date: Jun 2004
Location: Brooklyn/Rochester
Posts: 53
sammy is on a distinguished road
Send a message via AIM to sammy
Thats strange...I tried to replicate your error and my data was not erased.
PHP Code:
<?
if( $HTTP_POST_VARS['summ'] == "submitted"){
        print 
"submitted";
        
$val $HTTP_POST_VARS['sammyz'];
}
?>
<form name="sammy" action="index.php" method="post">
<input type="text" value="<?echo $val?>"name="sammyz" size="20">
<input type="hidden" name="summ" value="submitted">
<input type="checkbox" name="chekbox">
<input type="submit">
</form>
<?
function printEr(){
        print(
"
        <script type='text/javascript' language='javascript'>
        <!--
        alert('Error');
        //-->
        </script>
        "
);
}
if( 
$HTTP_POST_VARS['chekbox'] ){
        
printEr();
}

?>
please forgive the messy coding, i just wanted to test how the data could have been erased.
basically i have a form that if the check box is checked, it will alert and simulate an error, then populate the form with the users data. When i press OK, the data remains
__________________
sammy is offline   Reply With Quote
Old 06-30-2004, 11:52 AM   #3 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
thanks for working that out sammy. i was doing weird header stuff that i didn't think about which was switching between 2 pages without me really seeing it. ( with php )

thanks.
__________________
Mike
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Small modification needed on image flipping JavaScript Epsilon HTML, XML, Javascript, AJAX 0 08-31-2004 05:06 PM
Using javascript to submit a form sammy HTML, XML, Javascript, AJAX 2 07-15-2004 01:31 PM
Javascript Function jcramer83 HTML, XML, Javascript, AJAX 5 04-14-2003 06:12 AM
javascript function help.. Admin HTML, XML, Javascript, AJAX 2 03-09-2003 06:35 PM


All times are GMT -8. The time now is 02:09 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting