Field Validation stops javascript function from executing

A

Alan in KY

I have a javascript function created by Matt Kruse that creates a
popup calendar that populates my field RequestedDate. It worked fine
until I added a numeric validator on another field (DeclaredValue) on
my form and an integer validator on another field (DockClearance).

Now the popup does not seem to execute. The behavior is consistent in
both Firefox 3.0.3 and IE7.
I do not receive an error in Firefox, but in IE7 I get the following
message. Line 130, char 1, Error:
'document.forms.FreightRequest.RequestedDate' is null or not an
object. Code 0
Where FreightRequest is the name of the form.


If I remove the validators it works again.

Any ideas about what the problem might be.
 
T

Thomas A. Rowe

I think all you will need to do is change the reference to the form in your script to match the form
name assigned by FP.
--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage
http://www.Ecom-Data.com
==============================================
 
A

Alan in KY

I think all you will need to do is change the reference to the form in your script to match the form
name assigned by FP.
--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPagehttp://www.Ecom-Data.com
==============================================

I'm not sure I understand what you mean.
FP didn't assign a name to the form.
And the script will not run unless it has a name.

If you want check out Marscopiers.com
You will not see the javascript since it's in a external js file.
But the calendar popup is in public domain thanks to the wishes of the
author.

Alan
 
T

Trevor Lawrence

Reply at bottom

I think all you will need to do is change the reference to the form in
your script to match the form
name assigned by FP.
--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPagehttp://www.Ecom-Data.com
==============================================

I'm not sure I understand what you mean.
FP didn't assign a name to the form.
And the script will not run unless it has a name.

If you want check out Marscopiers.com
You will not see the javascript since it's in a external js file.
But the calendar popup is in public domain thanks to the wishes of the
author.

Alan


REPLY
=====

Someone assigned the name 'FreightRequest'

And the script *will* run without a name - a numbered reference is
sufficient

To be more precise,

I did check out marscopier.com and your HTML reads (in part)
<td width="26%">
<input type="text" value="" name="RequestedDate" size="25">
<A HREF="#"
onClick="cal.select(document.forms['FreightRequest'].RequestedDate,'anchor1','MM/dd/yyyy');
return false;" NAME="anchor1" ID="anchor1">Select Date</A>
</td>

Without even looking at CalendarPopup(), this implies that the form
'FreightRequest' must exist and in it must be a field "RequestedDate"

The only form that I can find is
<form name="FrontPage_Form1".....
and the input field with name="RequestedDate" is in this form.

I suggest changing the form name to 'FreightRequest'

Either that, or do as suggested by the comment in
http://marscopiers.com/JavaScript/CalendarPopup.js
// This is an example call to the popup calendar from a link to populate an
// input box. Note that to use this, date.js must also be included!!
<A HREF="#"
onClick="cal.select(document.forms[0].date,'anchorname','MM/dd/yyyy');
return false;">Select</A>

document.forms[0] is a reference is to the first (and only) form on the HTML
page

BTW, I can't see where function FrontPage_Form1_Validator() is called
 
R

Ronx

If using FrontPage validation you cannot change the form name -
FrontPage will always rename the form to "FrontPage_Form1" (the 1 at
the end could be a 2 if there are 2 forms on the page, and so on). Any
JavaScript that refers to the form must have the name in the Javascript
changed to match the FrontPage name, or use some other means of
validation, for example copy the validation script FP produces and add
it to your own.

--
Ron Symonds - Microsoft MVP (Expression)
Reply only to group - emails will be deleted unread.

http://www.rxs-enterprises.org/fp




Reply at bottom

I think all you will need to do is change the reference to the form in
your script to match the form
name assigned by FP.
--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPagehttp://www.Ecom-Data.com
==============================================

I'm not sure I understand what you mean.
FP didn't assign a name to the form.
And the script will not run unless it has a name.

If you want check out Marscopiers.com
You will not see the javascript since it's in a external js file.
But the calendar popup is in public domain thanks to the wishes of the
author.

Alan


REPLY
=====

Someone assigned the name 'FreightRequest'

And the script *will* run without a name - a numbered reference is
sufficient

To be more precise,

I did check out marscopier.com and your HTML reads (in part)
<td width="26%">
<input type="text" value="" name="RequestedDate" size="25">
<A HREF="#"
onClick="cal.select(document.forms['FreightRequest'].RequestedDate,'anchor1','MM/dd/yyyy');
return false;" NAME="anchor1" ID="anchor1">Select Date</A>
</td>

Without even looking at CalendarPopup(), this implies that the form
'FreightRequest' must exist and in it must be a field "RequestedDate"

The only form that I can find is
<form name="FrontPage_Form1".....
and the input field with name="RequestedDate" is in this form.

I suggest changing the form name to 'FreightRequest'

Either that, or do as suggested by the comment in
http://marscopiers.com/JavaScript/CalendarPopup.js
// This is an example call to the popup calendar from a link to populate an
// input box. Note that to use this, date.js must also be included!!
<A HREF="#"
onClick="cal.select(document.forms[0].date,'anchorname','MM/dd/yyyy');
return false;">Select</A>

document.forms[0] is a reference is to the first (and only) form on the HTML
page

BTW, I can't see where function FrontPage_Form1_Validator() is called
 
T

Thomas A. Rowe

FYI: The CalendarPopup.js is download to a user's Temporary Internet Files folder.

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage
http://www.Ecom-Data.com
==============================================


I think all you will need to do is change the reference to the form in your script to match the
form
name assigned by FP.
--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPagehttp://www.Ecom-Data.com
==============================================

I'm not sure I understand what you mean.
FP didn't assign a name to the form.
And the script will not run unless it has a name.

If you want check out Marscopiers.com
You will not see the javascript since it's in a external js file.
But the calendar popup is in public domain thanks to the wishes of the
author.

Alan
 
A

Alan in KY

Reply at bottom

I think all you will need to do is change the reference to the form in
your script to match the form
name assigned by FP.
--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPagehttp://www.Ecom-Data.com
==============================================

I'm not sure I understand what you mean.
FP didn't assign a name to the form.
And the script will not run unless it has a name.

If you want check out Marscopiers.com
You will not see the javascript since it's in a external js file.
But the calendar popup is in public domain thanks to the wishes of the
author.

Alan

REPLY
=====

Someone assigned the name 'FreightRequest'

And the script *will* run without a name - a numbered reference is
sufficient

To be more precise,

I did check out marscopier.com and your HTML reads (in part)
<td width="26%">
    <input type="text" value="" name="RequestedDate" size="25">
    <A HREF="#"
onClick="cal.select(document.forms['FreightRequest'].RequestedDate,'anchor1','MM/dd/yyyy');
return false;" NAME="anchor1" ID="anchor1">Select Date</A>
   </td>

Without even looking at CalendarPopup(), this implies that the form
'FreightRequest' must exist and in it must be a field "RequestedDate"

The only form that I can find is
<form name="FrontPage_Form1".....
and the input field with name="RequestedDate" is in this form.

I suggest changing the form name to 'FreightRequest'

Either that, or do as suggested by the comment inhttp://marscopiers.com/JavaScript/CalendarPopup.js
// This is an example call to the popup calendar from a link to populate an
// input box. Note that to use this, date.js must also be included!!
<A HREF="#"
onClick="cal.select(document.forms[0].date,'anchorname','MM/dd/yyyy');
return false;">Select</A>

document.forms[0] is a reference is to the first (and only) form on the HTML
page

BTW, I can't see where function FrontPage_Form1_Validator() is called

Thanks changing the anchor reference to document.forms[0] worked.
I didn't catch the fact that the form name was overwritten with
FrontPage_Form1
I originally called the form FreightRequest.
I haven't worked much with Frontpage. I've been mostly developing web
apps with DNN recently, and prior to that I mostly used Dreamweaver.
So it's the little things that Frontpage does that I'm not aware of.

Again thanks for everyones help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top