autocomplete validation?

194 views
Skip to first unread message

RMP User

unread,
May 28, 2015, 1:32:47 PM5/28/15
to suppor...@runmyprocess.com
We're using autocomplete in a text field with data from a collection.
Is there a way to enforce/validate that the submitted field value is a valid string from the collection?

For example, user ignores the autocomplete and enters some random string, we want to disallow such submissions.

Thanks!

Murali

unread,
May 30, 2015, 5:37:54 AM5/30/15
to suppor...@runmyprocess.com, tedd...@nana.com, tedd...@nana.com
Hi,

Create a js widget that listens to text field variable (user_name) and include below script.

function list_ok(result) {
    //alert("ok=" + JSON.stringify(result));
    if(result.length ==0)
    {
        alert("name not found in collection");
    }
}

function list_ko(result) {
    alert("ko=" + JSON.stringify(result));
}

var my_pattern = {};
my_pattern.name = "[[user_name]]";

col_users_info.listCallback(my_pattern,{},list_ok,list_ko);

Regards,
Murali

tedd...@nana.com

unread,
Jun 1, 2015, 5:35:28 PM6/1/15
to suppor...@runmyprocess.com, tedd...@nana.com
Thank, Murali! that was great.

The only minor change I added was to make the field required and set the field to "" so that user would not ignore the warning since they won't be able to submit unless correct data was entered.

function list_ok(result) {
    if(result.length ==0)
    {
        alert("name not found in collection");
        RMPApplication.set("user_name","");
Reply all
Reply to author
Forward
0 new messages