xriokax Posted September 30, 2010 Share Posted September 30, 2010 Hello I have the following code that validates my form prior to saving...among other things, it checks to make sure the field "claim_num" is not blank. How can I change this code so I can verify if the field "claim_num" has a minimum of 7 characters? Thanks Paul if ($('#claim_num').val() == "" || $('#loss_date2').val() == "" || $('#ucr').val() == "" || $('#loss_type2').val() == 0 || $('#causecode2').val() == 0 || $("#claim_status2").val() == "") { $('#err_msg').hide('slow').show('slow'); } else { $('#err_msg').hide('slow'); $('#event_type').val('save'); $('#claim_add_frm').submit(); } } Link to comment https://forums.phpfreaks.com/topic/214863-add-min-number-of-characters-in-string-help/ Share on other sites More sharing options...
Adam Posted October 1, 2010 Share Posted October 1, 2010 Using the .length property: if ($('#claim_num').length >= 7 || Link to comment https://forums.phpfreaks.com/topic/214863-add-min-number-of-characters-in-string-help/#findComment-1117880 Share on other sites More sharing options...
xriokax Posted October 1, 2010 Author Share Posted October 1, 2010 Ahhh excellent thanks Link to comment https://forums.phpfreaks.com/topic/214863-add-min-number-of-characters-in-string-help/#findComment-1117883 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.