RobColborne
MIS
I am writing some custom code for an application that allows javascript extenstions. All the code does is to check a passport expiry date.
The app displays two screens; a read only summary screen and then a edit screen.
On the summary screen the field is hidden and has the name
"_HIDDENpers_passport" but on the edit screen it has the "name pers_passport".
So I have written the following code which works on the Summary screen but not on the Edit screen due to the different names of the forms objects. The application uses the same piece of code for both screens, and there is no way round this.
Is there anyway to check the existence of the objects? Or perhaps supress the errors and write extra code to accomodate both states?
Thanks
Rob
The app displays two screens; a read only summary screen and then a edit screen.
On the summary screen the field is hidden and has the name
"_HIDDENpers_passport" but on the edit screen it has the "name pers_passport".
So I have written the following code which works on the Summary screen but not on the Edit screen due to the different names of the forms objects. The application uses the same piece of code for both screens, and there is no way round this.
Code:
<script language="javascript">
window.onload = function pd()
{
var pd =document.all._HIDDENpers_passport.value;
if (new Date(pd) < new Date()){
alert ("Passport Expired!");
}
}</script>
Is there anyway to check the existence of the objects? Or perhaps supress the errors and write extra code to accomodate both states?
Thanks
Rob