Welcome to WebmasterWorld Guest from 54.167.85.221

Forum Moderators: open

Message Too Old, No Replies

calling external javascript with an onBlur event

     

vijer

9:43 pm on Nov 13, 2003 (gmt 0)

10+ Year Member



I am trying to call an external javascript file when an onBlur event is triggered.

In the header

<script language="JavaScript" src="validateEntry.js"></script>

In the body

<input type=text name=DateEntered value="<%= sDateEntered %>" size=15 onBlur="isDate(this);">

in the javascript file validateEntry.js

function isDate(field) {
var validValue = /^\b(1[0-2]¦0?[1-9])\/(0?[1-9]¦[12][0-9]¦3[01])\/((19¦20)\d{2})(\s)(0?[0-9]¦1[0-9]¦2[0-4]):[012345][0-9]$/;
if (field.value!= "" &&!validValue.test(field.value)) {
status = field.name + ": Value is: " + field.value + " Length is: " + field.value.length;
//alert(field.name + ": This field requires m/dd/yyyy hh:mm format")
field.focus();
return false;
}
return true;
}

All I get is an object expected error when the onBlur event triggers.

Any help would be appreciated.

Vij

mikegram

3:44 pm on Nov 17, 2003 (gmt 0)

10+ Year Member



Since you haven't gotten a response yet, I will offer a wild guess. I think the function is having trouble with your SSI. Maybe (BIG MAYBE) this will work.

<script language="JavaScript" type="text/javascript">
var myDate = <%= sDateEntered %>;
document.write('<input type="text" name="DateEntered" value="'
+ myDate +
'" size="15" onBlur="isDate(this);">');
</script>

vijer

4:08 pm on Nov 17, 2003 (gmt 0)

10+ Year Member



Mike,

Thanks for the input, as it turns out the reason I was getting the error message was because the browers cache needed to be flushed. After clearing the cache the error went away and the code ran as expected.

Thanks

Vij

mikegram

4:44 pm on Nov 17, 2003 (gmt 0)

10+ Year Member



I would not have thought of that, but I will from now on.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month