jQuery-Validation-Engine icon indicating copy to clipboard operation
jQuery-Validation-Engine copied to clipboard

Multiple Forms with same field names result in wrong validation

Open co-operation opened this issue 15 years ago • 48 comments

If there are multiple forms on one page, and two different forms share a field with the same field name but different id (valid html, form names may be identical as long as they are not inside one form), validation messages appear at the first form within the DOM.

Validation should b based on id's, not field names.

co-operation avatar Jul 29 '11 09:07 co-operation

The issue is not 100% reproduceable, I will try to figure out the conditions for that error to occur

co-operation avatar Jul 29 '11 10:07 co-operation

I think i know how it happened, radio buttons and checkbox are sometimes based on name, because they are grouped, there is probably a $(form).find... missing somewhere

posabsolute avatar Jul 29 '11 15:07 posabsolute

Hi, I have exactly the same problem. How can I resolve it?

Thanks in advance Bye Andrea

Zanfe avatar Jul 29 '11 15:07 Zanfe

Do you use the latest version? (not the package)

posabsolute avatar Jul 29 '11 16:07 posabsolute

I downloaded the zip file from link "Downloads" Is it not right? Where is the link for the latest version?

Thanks Bye

Zanfe avatar Jul 29 '11 18:07 Zanfe

the lastest latest should come as a result of

git clone [email protected]:posabsolute/jQuery-Validation-Engine.git or by hitting the download button in the git project page

Sincerely,

orefalo avatar Jul 29 '11 18:07 orefalo

I downloaded the latest version 2 weeks ago (Version 2.2), together with jquery 1.6.1 - with this version I had the issue. After a new download today + jQuery 1.6.2 everything works great again! I love it.

co-operation avatar Jul 29 '11 19:07 co-operation

I downloaded the last version and I have JQuery 1.6.2 but doesn't work. It's very weird. Maybe the problem is that I have the same id, not only the same name. Is this a problem?

Thanks Bye

Zanfe avatar Aug 02 '11 23:08 Zanfe

This will not work, because it is no valid html, the id must be unique in a document.

http://www.w3.org/TR/html4/struct/global.html#h-7.5.2

co-operation avatar Aug 03 '11 07:08 co-operation

You can't have same id, happy its back working, i will create a new package soon, im afraid lots people do not take the edge version

posabsolute avatar Aug 03 '11 12:08 posabsolute

Thanks. No problem for the ID, I changed them, but the problem is that with the same NAME it doesn't work. It works only with different NAME, but I can't use different NAME. Any idea?

Zanfe avatar Aug 04 '11 21:08 Zanfe

Did you download the latest version? Attention: it still has the same version-number but some bugs where fixed! It helped me to resolve this issue.

co-operation avatar Aug 04 '11 21:08 co-operation

Yes, I have it. I downloaded a lot of times... Could you attach here the latest version, please? So I can compare my version with the latest? Thanks

Zanfe avatar Aug 05 '11 00:08 Zanfe

The last version is currently the same as the latest, package version 2.2.1

posabsolute avatar Aug 05 '11 18:08 posabsolute

Hi, I have dowloaded the package 2.2.1 and the file JS is just alike the mine one. Sorry but I have no idea what I have to do. Bye Andrea

Zanfe avatar Aug 08 '11 13:08 Zanfe

Do you have an online example which does not work?

co-operation avatar Aug 08 '11 13:08 co-operation

Unfortunately no because the site is again under development.

I can copy here the HTML for the two form: `

Login:

`

`


Password dimenticata? >
Non sei ancora iscritto? >

`

We use this link for the jquery library: https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js The problem there is also donwloading the version 1.6.2 from the jquery site.

Any help? Thanks Bye

Zanfe avatar Aug 08 '11 14:08 Zanfe

Any help?

Zanfe avatar Aug 10 '11 17:08 Zanfe

Your code works, so the error must be inside your html-head / init or inclusion of js. Please check with a js debugger, it should show you an error.

Your working code (unchanged, just added the html-wrap and include files / W3C valid): http://data.co-operation.de/test/jquery.validationEngine/

co-operation avatar Aug 11 '11 11:08 co-operation

Thanks.

In the first form the problem doesn't exist. The form works. My problem is in the second form. In my site if I click submit button, for the second form, with the empty fields, the js controll appears in the first form.

In your link (thanks) if you click the submit button in the first form the js works (like in my site), instead if you click the submit button in the second form the js doesn't work.

Me and my js debugger have no idea.

Zanfe avatar Aug 12 '11 13:08 Zanfe