Hi All,
I am using jquery to validate the form. But i got a problem to validate completely. Somewhere i have an element like:
<select name="relation_cd[]" id="relation_cd">
</selelct>
<select name="relation_cd[]" id="relation_cd">
</selelct>
Which comes from database dynamically.
Is there any technique to validate such kind of element in jquery?
I didn't find the way to validate. I am new to jquery even i don't know how to add the custom validation function so that i can validate the form completely.
Hope, i will get some suggestion from you guys.
Thanks
input text array validation in jquery
Moderator: General Moderators
-
charlestide
- Forum Newbie
- Posts: 3
- Joined: Fri Apr 17, 2009 1:21 am
Re: input text array validation in jquery
i have not found any rule for your validator, so i can just tell you how to select those elements.
the function will occur when all of SELECT tags that NAME start with relation_cd. but i have no test for this. if it not work, may be you could add your own attribuates to the SELECT, such as <select name="relation_cd[]" use="validator">
my english is poor, hope you can understand what i said
Code: Select all
$('select[@name^=relation_cd]').change(function(){
//here is your validating code
});
my english is poor, hope you can understand what i said
Re: input text array validation in jquery
Your code is invalid. You can't have 2 elements with the same ID. ID must be unique.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Re: input text array validation in jquery
Thanks for your reply guys.
I couldn't validate it using jquery. Still finding the way to validate it.
Thanks
Currently, ID is use less, it used name for the validation.Your code is invalid. You can't have 2 elements with the same ID. ID must be unique.
I couldn't validate it using jquery. Still finding the way to validate it.
Thanks
Re: input text array validation in jquery
From jQuery documentation
Correct selector will beNote: In jQuery 1.3 [@attr] style selectors were removed (they were previously deprecated in jQuery 1.2). Simply remove the '@' symbol from your selectors in order to make them work again.
Code: Select all
select[name^=relation_cd]