Hi All, Firstly my apologies in advance. I'm not a developer by trade (just a designer trying to fudge a script !! My aim is to validate a value entered into a field. If it matches the exact value stated in the javascript, a hidden DIV appears. I've found 2 scripts that both have traits that I needed and I've tried to combine them, but with little success. Im hoping that someone might be able to point me in the right direction? The code Im using is below... Thanks in advance! <SCRIPT TYPE="text/javascript"> ("#parent1").css("display","none"); function checkcode(tf_sponsor) { if(tf_sponsor.length > 0) { if (tf_sponsor.indexOf = "test") { $("#parent1").slideDown("fast"); //Slide Down Effect } else { $("#parent1").slideUp("fast"); //Slide Up Effect } } } </SCRIPT> <input name="tf_sponsor" type="text" id="tf_sponsor" size="8" onChange="checkcode(this.value)"> <div id="parent1">WORKS!</div> Code (markup):
It's not clear what the function checkcode(tf_sponsor) will return. I think you have got it wrong within the function declaration although I can't provide the solution.
Once the user looks at the source and sees if (tf_sponsor.indexOf = "test") { Code (markup): the mystery is all over. Use AJAX to get the user's input and compare it to the target text in the server. You'll have to pay a developer to write the code or learn some programming yourself. (I'm not commenting on your syntax here, just the basic idea. Since it shouldn't be done this way any syntax errors are irrelevant.)