Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi good afternoon to all.



Here i'm providing a auto list to the user.If the user enter a value like S then the auto list shows all the values starting with S,but user didn't select value from the auto list and click the insert button then in the table save the value with S.


Here my requirement is if user didn't select any value from the auto list then get a alert my select any value....when click the insert button.

please help to resolve this issue.

Thanks in Advance.
Posted
Comments
aarif moh shaikh 23-Sep-15 6:58am    
is this list coming from DB? if yes ... before saving data you have to check first your textbox value into DB

1 solution

Take a hidden field. When user select a value from your auto list starting from s, you assign that value to hidden field. While inserting data check if hidden field is null or not. That will solve your issue.
 
Share this answer
 
v2
Comments
RamAchanta 23-Sep-15 6:19am    
thank you...
RamAchanta 23-Sep-15 6:20am    
can you give any example for that.
Member 12003400 23-Sep-15 6:37am    
select: function (event, ui) {
if (ui.item) {
var check = ui.item.id;
document.getElementById('Hiddenfieldid').value = check;
}
}

and then on insert button click

function functioninsert() {
var val1;
if ($("#Hiddenfieldid"))
val1 = $("#Hiddenfieldid").val();
if (val1== null || val1 == "") {
alert("Please Select Value.");
return false;
}
}
RamAchanta 23-Sep-15 6:39am    
thank you so much...
Member 12003400 23-Sep-15 6:40am    
Please accept answer if it works. SO this query can be closed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900