Trying to rebuild a picklist from user object

Posted by ByronB on 24-Jan-2015 04:36

Hi there

I am removing and adding values to a user lookup (picklist) based on certain criteria. On changing of a field I am trying to rebuild the full user picklist to then refilter (remove values) out. I am using the following:

function cb(divVal)
{
/*$('#accountManager').find('option')
.remove()
.end()
;*/
alert(divVal);
for(var i=0; i<divVal.length; i++)
{
var divAcctMgrId = divVal[0][0];
var divAcctMgrName = divVal[0][1];
$('#accountManager').append("<option value=" + divAcctMgrId + ">" + divAcctMgrName + " | Test</option>");
}
}
rbf_selectQuery("select id, name from USER", 50, cb)

The alert brings up the following:

"First Admin,Second Admin,Hosny Ansar,Phil Smith,Byron Branfield,Iram Khan,Kevin Palmer,Meryem Kesmi,Adrian Young,Jon Starkey" 

I also get the following error:

Error! Error in SQL Query select id, name from USER where id=Jon Starkey You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Starkey)' at line 1

All Replies

Posted by Manooj Murali on 24-Jan-2015 06:28

The error comes because the where criteria should be in quotes. (say something like this : select id, name from USER where id='Jon Starkey'). But, since you are saying the alert brings up the right results, I dont think the error comes from the selectQuery call you have pasted here. May be there is some other query that gets fired with an incorrect query.

Posted by pvorobie on 24-Jan-2015 20:29

Modification of control on UI page will not modify field's options stored in DB. What you're trying to achieve?

This thread is closed