Skip to main content

Bug Tracker

Side navigation

#2561 closed enhancement (invalid)

Opened March 19, 2008 08:16PM UTC

Closed July 13, 2008 12:34PM UTC

Last modified March 15, 2012 06:31PM UTC

[validate] custom errorPlacement

Reported by: sniffer Owned by: joern
Priority: minor Milestone:
Component: plugin Version:
Keywords: validation errorPlacement Cc:
Blocked by: Blocking:

Text below taken from

I have created a test page at Jörn's request - this can be found here:

Let me know if you need any more info.

Thanks for your time



I've been using the validation plugin quite happily (it's a great

plugin), but I've just tried to implement a datepicker on one of my

forms and I cannot get the error to show correctly.

My original markup is like this:

<label for="title_publication_date">Publication date:</label>

<input id="title_publication_date" name="title_publication_date"

type="text" />

<span class="status"></span>

But the datepicker (which is part of jquery UI) amends the markup on the fly to produce:

<label for="title_publication_date">Publication date:</label>

<span class="datepicker_wrap">

<input id="title_publication_date" class="hasDatepicker" type="text" name="title_publication_date"/>

<img class="datepicker_trigger" title="..." alt="..." src="../../Common/Images/calendar.gif"/>


<span class="status"></span>

I've got the following validation rules on this input:

title_publication_date: { required: true, date: true }

Unfortunately, if I leave the input field blank the validation doesn't appear to run - or I probably should say - the validation runs, but I can't see the error message.

I've tried amending the errorPlacement as follows (see 2nd else if

statement), but this doesn't seem to work:

errorPlacement: function(error, element) {

if (":radio") )

error.appendTo( element.parent().next().next('span') );

else if (":checkbox") )

error.appendTo ('span') );

else if (":input" &&"#title_publication_date")))

error.appendTo ( element.parent().next('span') );


error.appendTo('span') );


Is there any way that I can target the "#title_publication_date" input specifically and have a cusotm errorPlacement for it?

Thanks for your time


Attachments (0)
Change History (2)

Changed May 25, 2008 11:37AM UTC by joern comment:1

owner: → joern
summary: validation plugin: custom errorPlacement[validate] custom errorPlacement

Changed July 13, 2008 12:34PM UTC by joern comment:2

resolution: → invalid
status: newclosed

This works fine on your testpage:

if ("#textdate1") )
	error.appendTo ( element.parent().next('span') );
	error.appendTo('span') );

I therefore consider this ticket invalid.