vngx
May 7, 2015, 5:58am
1
Hi there this is my jsfiddle
Which is working fine validation
But when I add this code in my validate method in js
errorPlacement: function (error, el) { if (el.attr('name') === 'userGender') {error.appendTo('#groupErrors'); } else error.appendAfter(el);}}
after messages then its not working
Where is error?
Thanks
Use the TidyUp button after adding the code, then use the JSHint button to find and fix the obvious errors.
I believe that you can find and fix this problem yourself.
vngx
May 7, 2015, 6:25am
3
I tried TidyUp and JSHint
Not working
updated code
problem is that while I place errorPlacement block.
If I do not place that block everything is working fine
vngx:
Where is error?
Good job - try using insertAfter instead of appendAfter
vngx
May 7, 2015, 7:26am
5
Thanks for InsertAfter
I have also Integrated CheckBox validations
But Now message of RadioButton is showing in the start not in its custom position
(I have also made some div block on/off change that’s why my code look so change then previous but that’s not an issue that was working fine)
Do you see how you have two errorPlacement functions? One of them ends up replacing the other.
You need to combine their code together, most likely by using an if/else if/else structure.
vngx
May 7, 2015, 12:37pm
7
How do I differentate between them one case I am getting value using elements and in second case I am getting values using groups?
It looks like you need to learn some of the basics, on how to structure else if sections.
Some good info about them are at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/if...else
After using TidyUp it also becomes clear that you are missing a closing brace from somewhere after errorPlacement section.
Do you want to see if you can figure out where that problem lies?
system
Closed
August 7, 2015, 5:54am
11
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.