This code works fine...though it may be difficult to read. However I want to conform to jshint.com, and perhaps make it more readable.
There are so many different ways to change this I don't know the best way?
Basically I need to be able to turn client_validatin on/off. And if data validates than I make the ajax call to the server.
This felt like a hack when I wrote it, particularly the use of client_fail (i.e. used to determine if the client passed validation.
For this code
function interface_signin()
{
var form_name='signin',
form_elements=document.forms[form_name].elements,
response_div='signin_response',
client_fail=0;
if(arc.client_validation===1)
{
(client_fail=1)&&check_empty(form_elements,response_div,messages.empty)&&check_item(patterns.email,form_elements[0],response_div,messages.email)&&check_item(patterns.pass,form_elements[1],response_div,messages.validate)&&(client_fail=0);
}
if(client_fail===0){ajax('arche_model.php',serialize(form_name)+'&a=signin',ajax_signin,response_div);}
}
I get Errors
Line 466: (client_fail=1)&&check_empty(form_elements,response_div,messages.empty)&&check_item(patterns.email,form_elements[0],response_div,messages.email)&&check_item(patterns.pass,form_elements[1],response_div,messages.validate)&&(client_fail=0);
Expected an assignment or function call and instead saw an expression.