Page 1 of 1

Populate list service where clause with text from input text box.

Posted: Tue Mar 21, 2017 8:46 pm
by Oldestman57

I have a list service with a where clause {"username":"test user 11"}; It is mapped to a list item named userlistItem and invoked on page load. It works.
I want to have text from an input box called "usernameinput" to replace "test user 11" in the service when I invoke it from a button named "list Userbutton". Screenshot
Image
Do I have to load the textbox input to a local storage variable and map the storage variable to the where clause.
Any help would be appreciated.


Populate list service where clause with text from input text box.

Posted: Tue Mar 21, 2017 9:29 pm
by Serhii Kulibaba

Hello,

Please use this input component in the "before send" mapping: https://docs.appery.io/docs/appbuilde...


Populate list service where clause with text from input text box.

Posted: Tue Mar 21, 2017 11:23 pm
by Oldestman57

Thanks for the fast response.
When I try to map the usernameinput text box to the where clause in the service. The list item for the user name is no longer visible on the page when I test it.
Does there need to be JS included to set the username field to the input text box?
Image
I tried ' {"username" : "usernameinput"};', didn't work.


Populate list service where clause with text from input text box.

Posted: Wed Mar 22, 2017 8:44 pm
by Serhii Kulibaba

Please add a JS code to that mapping arrow:
prereturn {"username" : value};/pre


Populate list service where clause with text from input text box.

Posted: Wed Mar 22, 2017 8:59 pm
by Oldestman57

Thanks so much, works great!