I have a problem with my address data. So either you enter a new address (all of the fields are inputfields except gender,selection, it’s a radiobutton), or you select an address from a given list, so if you want the one from the list(selected with a radiobutton -> input[@name='select_address']), all the inputfields are not required anymore …
rules: {
delivery_gender:
{required:"input[@name='select_address'].not(':checked')"}
So the field gender should only be required if the input select-field (input[@name='select_address) is not checked. What am I doing wrong?
I’ve also tried another way:
$('input:radio[name=select_address]').click(function() {
delivery_gender.rules('remove');
but it won’t work either. Any ideas?
The problem only comes up with the radiobuttons because for the input-fields i just removed the class:
$('input.delivery').removeClass('required error');
Try using a dependancy callback :
This checks if the value of the checked radio button in the group
select_addressis equal to custom – if it is then the gender field is required.working example here – in the example you need to select
customto make thegenderfield required.