I am doing the JavaScript validation of SP 2010 list mynewcustomform.aspx page using the code written in content editor web part.
Fields are: textbox1, textbox2, textbox3.
var valoftxt1 = SPUtility.GetSPField('field1name').GetValue();
alert(valoftxt1 + ' == is the value ');
if(valoftxt1 == null ) { return false; }
if(valofestimatedsize == null || valofestimatedsize.trim()
=="")
{
alert('Estimated size field is mandatory');
return false;
} //till here the code is working fine
///////not working code from below onwards /////
var valDurationinMonthsNew =
SPUtility.GetSPFieldByInternalName
('Duration_x0020__x0028_in_x0020_M').GetValue();
alert(valDurationinMonthsNew + ' ==is the new duration in months field
internal name');
if(valDurationinMonthsNew == null || valDurationinMonthsNew.trim()
=="")
{
alert('inside duration in months validation if condition');
alert('Duration in months is mandatory field!');
return false;
}
But I am not able to proceed with further validation of other fields.
I would like to know how to proceed with the other form fields' validation? Shouldn't I return return false statement on the first statement itself?