I have a template that has a form with two input boxes. The problem is that I need to ensure that only one of either box has a filled value. That is, one text box should be empty. Since Django doesn't provide this kind of an OR mechanism, I am checking this through Javascript in the template:
function validateData() {
if ($("#email").val() && $("#cellno").val()){
alert("Please Enter either E-Mail Address or Cell Number");
} else {
alert("Form submitted successfully");
// redirect to view_2
}
}
The issue is that I want to send the data from the textbox to view_2. How can I send the value of the textbox and also perform the validation? Without the JS validation I could have simply added the url to the form action.
}for your function. My brain immediatelly return a parse error when I read that code :)