|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
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
__________________
the coolest one |
|
#2
|
|||
|
|||
|
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:
|
|
#3
|
|||
|
|||
|
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 |
|
#4
|
||||
|
||||
|
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. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > window.reload |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|