Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 114341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:50:43+00:00 2026-05-11T02:50:43+00:00

I’m playing around with writing a jQuery plugin that uses an attribute to define

  • 0

I’m playing around with writing a jQuery plugin that uses an attribute to define form validation behavior (yes, I’m aware there’s already a validation plugin; this is as much a learning exercise as something I’ll be using). Ideally, I’d like to have something like this:

Example 1 – input:

<input id='name' type='text' v:onvalidate='return this.value.length > 0;' /> 

Example 2 – wrapper:

<div v:onvalidate='return $(this).find('[value]').length > 0;'>    <input id='field1' type='text' />    <input id='field2' type='text' />    <input id='field3' type='text' /> </div> 

Example 3 – predefined:

<input id='name' type='text' v:validation='not empty' /> 

The goal here is to allow my jQuery code to figure out which elements need to be validated (this is already done) and still have the markup be valid XHTML, which is what I’m having a problem with. I’m fairly sure this will require a combination of both DTD and XML Schema, but I’m not really quite sure how exactly to execute.

Based on this article, I’ve created the following DTD:

<!ENTITY % XHTML1-formvalidation1     PUBLIC  '-//W3C//DTD XHTML 1.1 +FormValidation 1.0//EN'             'http://new.dandoes.net/DTD/FormValidation1.dtd' > %XHTML1-formvalidation1;  <!ENTITY % Inlspecial.extra    '%div.qname; ' >  <!ENTITY % xhmtl-model.mod     SYSTEM 'formvalidation-model-1.mod' >   <!ENTITY % xhtml11.dtd     PUBLIC  '-//W3C//DTD XHTML 1.1//EN'             'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd' > %xhtml11.dtd; 

And here is ‘formvalidation-model-1’:

<!ATTLIST %div.qname;     %onvalidation   CDATA   #IMPLIED     %XHTML1-formvalidation1.xmlns.extra.attrib; > 

I’ve never done DTD before, so I’m not even really exactly sure what I’m doing. When I run my page through the W3 XHTML validator, I get 80+ errors because it’s getting duplicate definitions of all the XHTML elements. Am I at least on the right track? Any suggestions?


EDIT: I removed this section from my custom DTD, because it turned out that it was actually self-referencing, and the code I got the template from was really for combining two DTDs into one, not appending specific items to one:

<!ENTITY % XHTML1-formvalidation1     PUBLIC  '-//W3C//DTD XHTML 1.1 +FormValidation 1.0//EN'             'http://new.dandoes.net/DTD/FormValidation1.dtd' > %XHTML1-formvalidation1; 

I also removed this, because it wasn’t validating, and didn’t seem to be doing anything:

<!ENTITY % Inlspecial.extra    '%div.qname; ' > 

Additionally, I decided that since I’m only adding a handful of additional items, the separate files model recommended by W3 doesn’t really seem that helpful, so I’ve put everything into the dtd file, the content of which is now this:

<!ATTLIST div onvalidate CDATA  #IMPLIED> <!ENTITY % xhtml11.dtd     PUBLIC  '-//W3C//DTD XHTML 1.1//EN'             'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd' > %xhtml11.dtd; 

So now, I’m not getting any DTD-related validation errors, but the onvalidate attribute still is not valid.

Update: I’ve ditched the DTD and added a schema: http://schema.dandoes.net/FormValidation/1.0.xsd

Using v:onvalidate appears to validate in Visual Studio, but the W3C service still doesn’t like it.

Here’s a page where I’m using it so you can look at the source:

http://new.dandoes.net/auth

And here’s the link to the w3c validation result:

http://validator.w3.org/check?uri=http://new.dandoes.net/auth&charset=(detect+automatically)&doctype=Inline&group=0

Is this about as close as I’ll be able to get with this, or am I still doing something wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T02:50:44+00:00Added an answer on May 11, 2026 at 2:50 am

    If you want the result to be valid XHTML, I believe you’ll need to use XML namespaces rather than a custom DTD. Not only does the DTD define the language (and thus, a custom DTD isn’t ‘really’ XHTML), but it will throw any browsers that read it into quirks mode, even if they don’t choke on the file.

    Using a namespace, on the other hand, will produce perfectly valid XHTML (though not all validators are namespace-aware and may not validate it correctly) and allow browsers to work in (near-)standards mode.

    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'> <html xmlns='http://www.w3.org/1999/xhtml' xmlns:v='http://example.com/ns/validation' xml:lang='en'>     <head><title>Validation Example</title></head>      <body>         <input id='name1' type='text' v:onvalidate='return this.value.length &gt; 0;'/>         <input id='name2' type='text' v:validation='not empty'/>     </body> </html> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 96k
  • Answers 96k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Is this new development or maintenance of an existing project?… May 11, 2026 at 7:09 pm
  • Editorial Team
    Editorial Team added an answer Well, it kinda says in the errormessage what you do… May 11, 2026 at 7:09 pm
  • Editorial Team
    Editorial Team added an answer Firebug hands down the best web development tool there is.… May 11, 2026 at 7:09 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.