I am Developing a web application. For inputting values i am using an auto complete which gets its data from the database.
$(document).ready(function hello(){
var myVar1 = <%=request.getAttribute("variable1")%>
$("input#assignedbyid").autocomplete({
source: myVar1
});
});
The above given example gives me a set of values which are picked up from a database using JDBC and json code. AT any point of time the value in myvar1 looks like this::
["Kapil","Mayur","Abhinav","Chandan"]
Which comes as a source for auto complete values.
My html code where my input tag onfocus calls up the function hello().
<div id="lets"><input dojoType="dijit.form.ValidationTextBox" id="assignedbyid" name="assignedbyname" required="true" onfocus="hello();" onblur="hi();"></div>
Now i want to have a validation check which checks that value entered by the user comes from auto complete values only("Kapil","Mayur","Abhinav","Chandan") and not any other value. I have this Code where in if no value is entered the text box shakes up(onblur="hi();"). in else part i want to that checking to be done.
<script type="text/javascript">
function periodical() {
$('#lets').effect('shake', { times: 5 }, 200);
};
$(document).ready(function() {
$('#lets').hide().css('display','').fadeIn(600);
});
function hi(){
var dude = dojo.byId("assignedbyid").value;
if(dude==""){
periodical();}
else{
if(dude)
myVar1
alert("value entered");}
};
</script>
My else part is incomplete for the time being. how can this be done ?. Thanks .
or