473,761 Members | 4,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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).rea dy(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).rea dy(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 5743
On Aug 14, 7:18*pm, thj <to...@holmjako bsen.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).rea dy(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).rea dy(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
5512
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 first try. When it fails, the error message it gives is: "Cannot set the selected property. Unspecified error." FF2, IE7, and OP9 all behave as expected. I have tried a variety of workarounds to no avail. I don't have an exhaustive list of...
8
5794
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 = {"Message":"word s","Type":"System.NotSupportedException"};/*. Below is the relevant code. Thanks for your help. C# code: using AjaxPro; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs...
83
4229
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 it too? Once I saw a website comparing Prototype to Java and jQuery to Ruby... but now that I read more and more about Prototype, it is said that Prototype actually came from Ruby on Rails development and the creator of Prototype created it...
10
494
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 the different types of objects you can create as values. I really don't like using eval, and it's causing problems, like if I do something like the following:
20
2303
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
4961
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
1849
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 functions. On the html file this file is included in the <head> i had to change the link to include language="JavaScript" to fix some errors but was still left with 1 error.
6
4369
by: lochru45 | last post by:
I'm running the following javascript with no problem in FireFox: var multiGallery = { init: function(options){ this.overlay = new Element('div').setProperty('id','lbOverlay').injectInside(document.body).addEvent('click',this.close.bind(this)); this.gallery = new Element('div').setProperty('id','gallery').injectInside(document.body); this.fx = {
1
3885
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
9522
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9336
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9765
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8770
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6603
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3866
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.