I need your help.
I need to come up with a javascript function that would simply check a string entered into a textbox that would basically determine an SQL operator
example:
var field1 = document.getElementById('field1').value
var field2 = document.getElementById('field2').value
var field3 = document.getElementById('field3').value
function validate(textbox) {
var operator
if ('%' is the first character placed before and after the value) { then operator = LIKE }
else if ('%' is the first character placed before the value) { then operator = LIKE }
else if ('%' is the last character placed after the value) { then operator = LIKE }
else { operator equals "=" } //default
alert(operator)
}
example of function in action:
validate(field1)