JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 31st, 2003, 01:32 AM
sumicooldude sumicooldude is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 48 sumicooldude User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 59 sec
Reputation Power: 16
window.reload

Dear All,

i have created an asp page that contains some date, and to update that page ive create a popup update page, now the problem is when i update the page the contents are updated and the popup window closes but original contents on the main page remain there, and to view the changes i have to manually reload that page, i wud like to know that is there ne method by which i can auto reload my page only once after the pop up window closes

please help me

regards
Sumeet

Reply With Quote
  #2  
Old July 31st, 2003, 06:54 AM
EiSa EiSa is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Norway
Posts: 184 EiSa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 22 m 24 sec
Reputation Power: 16
Don't know much about Javascript, but if you do something with this script you can use it to refresh the main page. This script close the popup-window and refresh the parent window.

PHP Code:
<script language="JavaScript">
<!--
function 
refreshParent() {
  
window.opener.location.href window.opener.location.href;

  if (
window.opener.progressWindow)
        
 {
    
window.opener.progressWindow.close()
  }
  
window.close();
}
//-->
</script> 
Put it into your popup-page.

Reply With Quote
  #3  
Old July 31st, 2003, 08:14 AM
sumicooldude sumicooldude is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 48 sumicooldude User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 59 sec
Reputation Power: 16
thnx a lot buddy it did worked absolutely fine

now ive got 1 more question, i have a simple form in which i want the user to put date only in the format of (19-jul-03), if the user puts somethin else an error msg shud come.

can u help me with this, i'll be more than thankful to you guys

regards
Sumeet

Reply With Quote
  #4  
Old July 31st, 2003, 08:51 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to dhouston
The best way to handle this is probably by using regular expressions, which are kind of a pain in javascript. Check out devguru.com as a reference guide for that. The other might be to do something akin to the following (which probably won't work out of the gate, but which should give you a starting point):

Code:

<script language="javascript">

function check_date(date){
    thedate=new String(date);
    parts=thedate.split("-");
    if(parts.length != 3){
        alert('You have not provided a date in dd-mmm-yy format!');
        return false;
    }
    dayflag=0;
    days=new Array('01','02',...'31');
    for(i=0; i<days.length; i++){
        if(parts[0]==days[i]){
          dayflag=1;
          i=days.length+1;
        }
    }
    monthflag=0;
    months=new Array('jan','feb',...'dec');
    for(i=0; i<months.length; i++){
        if(parts[1]==months[i]){
          monthflag=1;
          i=months.length+1;
        }
    }
    yearflag=0;
    years=new Array('99','00','01','02','03'...);
    for(i=0; i<yearss.length; i++){
        if(parts[2]==years[i]){
          yearflag=1;
          i=years.length+1;
        }
    }
    if(dayflag==0 || yearflag==0 || monthflag==0){
        alert('The date format you have specified is invalid and should be submitted as dd-mmm-yy.');
        return false;
    }
    return true;
}

</script>


Not very efficient code, but that, or something like it, would verify that the values submitted match values you've specified as suitable. Your best bet is to build form controls that regulate how the user inputs the date. It's poor user interface to expect someone to provide the date by typing in the format you prefer. Consider using one of the many calendar widgets or even simple select boxes to control data input. This also makes validation easier for you on the back end.

If you're using PHP or perl, you might also try validating the date server side by checking the value passed against a regular expression like /\d\d-\w\w\w-\d\d/i.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > window.reload


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap