473,410 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

jquery-validate "object expected" error

thj
Hi.

I've got this form that I'm trying to validate:

<form id="periodForm" action="" method="post">
<p>
Periode:
<input id="startDate" name="startDate" type="text" size="7"
value="<%= ViewData["StartDate"] %>" />
-
<input id="endDate" name="endDate" type="text" size="7"
value="<%= ViewData["EndDate"] %>" />
<input id="submit" type="submit" value="Search" />
</p>
</form>

With the following jquery-validate code:
<script type="text/javascript">
$(document).ready(function()
{
$("#periodForm").validate(
{
rules:
{
startDate: "required",
endDate: "required"
},
messages:
{
startDate: "Skal angives",
endDate: "Skal angives"
}
});
});
</script>

When I'm pushing the submit button, the page reloads, and I get the
error "Object expected", on the line:
$(document).ready(function()

I've double checked everything, and can't find any errors - could you
please help me out here?

Thanks in advance.
Tommy.
Aug 14 '08 #1
2 5699
On Aug 14, 7:18*pm, thj <to...@holmjakobsen.dkwrote:
Hi.

I've got this form that I'm trying to validate:
[...]
With the following jquery-validate code:
[...]
I've double checked everything, and can't find any errors - could you
please help me out here?
Ask in a jQuery group.
--
Rob
Aug 14 '08 #2
On Aug 14, 10:18 am, thj wrote:
Hi.

I've got this form that I'm trying to validate:

<form id="periodForm" action="" method="post">
<p>
Periode:
<input id="startDate" name="startDate" type="text" size="7"
value="<%= ViewData["StartDate"] %>" />
-
<input id="endDate" name="endDate" type="text" size="7"
value="<%= ViewData["EndDate"] %>" />
<input id="submit" type="submit" value="Search" />
^^^^^^ ^^^^^^
Naming a submit button "submit" has the consequence of rendering the -
submit - method of forms unusable. None of the code you have posted
attempts to use the - submit - method, but that does not mean you
should get into the habit of using such names (see:-

<URL: http://jibbering.com/faq/faq_notes/f....html#faComMis >

), and it does not mean that the code not posted does not attempt to
use the - submit - method of the form. Although the error "object
expected" usually means that IE is attempting to execute a function
but the Identifier for the function did not resolve as an object (and
therefore not a function object, which is has to be if it is to be
called).

And the error message IE usually produces if you do attempt to use the
- submit - method of a form that has been replaced by an Element
reference is "Object doesn't support this property or method" (i.e. it
is an object but it does not support being called; it is not a
function object).
</p>
</form>

With the following jquery-validate code:
<script type="text/javascript">
$(document).ready(function()
{
$("#periodForm").validate(
{
rules:
{
startDate: "required",
endDate: "required"
},
messages:
{
startDate: "Skal angives",
endDate: "Skal angives"
}
});
});
</script>

When I'm pushing the submit button, the page reloads,
But does the validation happen before the page "reloads"?
and I get the
error "Object expected", on the line:
$(document).ready(function()
So this error does not occur the first time the page loads, only when
it is re-loaded following form submission? That seems very unlikely (I
realise that JQuery is badly enough written that inconsistent
behaviour is likely from it, but that line is the entry point, before
JQuery has really gotten going, so it should be consistent).

Incidentally, form validation is probably the one area of browser
scripting where it really is easy to write a one-code-fits-all system,
so why are you involving JQuery in the process and sacrificing all
that cross-browser compatibility?
I've double checked everything, and can't find any
errors - could you please help me out here?
Probably, but the odds are that you will never provide sufficient
context information or any sort of demonstration of the phenomenon.
Aug 14 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mr. Wilson | last post by:
On this page (just a demo) I can’t get IE6 to auto-select the first item in the dynamically-generated drop-down menus. Well, that isn’t entirely true. Sometimes it works properly, but never on the...
8
by: mikeh3275 | last post by:
I'm not sure if this belongs on this forum, but if anyone is still using AjaxPro, I'm trying to get it to work with jQuery. I keep getting errors returned similar to this one: null; r.error =...
83
by: liketofindoutwhy | last post by:
I am learning more and more Prototype and Script.aculo.us and got the Bungee book... and wonder if I should get some books on jQuery (jQuery in Action, and Learning jQuery) and start learning about...
10
by: Gordon | last post by:
I have a script that creates new objects based on the value of a form field. Basically, the code looks like this. eval ('new ' + objType.value + '(val1, val2, val3'); objType is a select with...
20
by: Aaron Gray | last post by:
There does not seem too be anyway to test if two jQuery references are the same element. Given :- ... <div id="1"></div .... Then :- alert( $("#1") == $("#1"))
53
by: Aaron Gray | last post by:
Due to M$'s stupidity in not making DOMElements first class citizens the following will not work :- function isElement( o) { return o instanceof Element } It works for FF, Opera and Safari.
7
by: Jabica | last post by:
I'm having an issue with a form page i created, it works fine in Firefox but causes an error in IE 7. i have a script file where in it it set a: var fReq = new Array(); Then follows some...
6
by: lochru45 | last post by:
I'm running the following javascript with no problem in FireFox: var multiGallery = { init: function(options){ this.overlay = new...
1
by: faultykid | last post by:
I would like to store a variable then call it back later. I have a variable on line 198 www = ''+this._ad.clickUrl+''; and on line 321 i try document.write(www);
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.