Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By shuqierduo
#790451
How do I test if a suggest control has successfully found something?

Name of control is "searchByName" with a sql "SELECT PARTY.PARTY_ID, CONCAT(PARTY.FIRST_NAME, " ", PARTY.LAST_NAME) AS PARTY_NAME FROM PARTY"

Database record is something like this

party_id, party_first_name, party_last_name
1,John,Lewis
2,Peter,Pan

Then on the Dynaform I would like to check if something is found. For example if "Peter" is input and selected

$("#searchByName").getValue() gives me "2" and $("#searchByName").getText() gives "Peter Pan"

However when I try below it always alert "found" even if I input "Mary" into the control

if ($("#searchByName").getValue() == $("#searchByName").getText() ) {
alert("not found");
} else {
alert("found");
}
By zainab
#790452
Hello,

Your code works fine, the only issue is you have to add an event so that whenever the value changes, the function is called upon which the alert will execute:
Code: Select all
function check()
{
//alert($("#suggest").getValue());
if ($("#suggest").getValue() == $("#suggest").getText() ) {
alert("not found");
} else {
alert("found");
}
  
}
$('#suggest').setOnchange(check);
where $('#suggest') is the id of my suggest control.
This code works perfect in my case.

Please let me know if this helps.

Best Regards,
Zainab

Web3 development encompasses creating decentralize[…]

The Upland Clone Script, offered by Dappsfirm, rep[…]

Dappsfirm offers a bet365 clone script that mirror[…]

🚀 Tauchen Sie mit Immediate Alora AI in die Welt d[…]