On pdf downlaod link need to open a jQuery dialog and have a form taking name, email and a confirmation checkbox.
There will be some validation on the fields eg. required min and max size etc...
Have initialised the dialog on page load and the dialog is opened on pdf download link.
$("#dialog").dialog({
bgiframe: true,
autoOpen: false,
modal: true,
buttons: {
Continue : function(){
var valid = true;
valid = valid && checkExists(name, 2, 50);
//valid = valid && checkEmail(email);
valid = valid && checkTrue(agree);
if(valid) {
//ajax call to controller
return true;
}
},
Cancel : function(){
$(this).dialog( close );
}
}
});
$("a.download-document").click(function(){
$("#dialog").dialog( open );
});
The problem I am having is that because I have no return false on the click event it will open the dialog but then continue with the click event.
How do I get the click event to only continue when the form is submitted and the validation OK?