Programmatically clear input text

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Manjastre
Posts: 6
Joined: Fri Jul 29, 2016 11:43 pm
Location: Poole, UK

Programmatically clear input text

Post by Manjastre »

First Post :)

I have a top bar menu item of type input control (like search) which stores a value in RegularUser.SearchFilter and calls a process.
I would like to clear the input field and reset to the "Undefined" text the moment the user clicks enter.

Resetting SearchFilter to "" does not reset the UI. Does this require javascript in the Advanced Render section?

This is how far I've got so far. Am I on the right lines? Or is it much simpler than this?

$("#" + parser.m_widgetInfo.wrapperId).find("aw_menu_top_bar_RegularUser_SearchFilter").val("").change();
BLOMASKY
Posts: 1471
Joined: Wed Sep 30, 2015 10:08 pm
Location: Ocala FL

Re: Programmatically clear input text

Post by BLOMASKY »

My suggestion, at the end of the process that is called, add a line:

LoggedInRegularUser.searchField = UNDEFINED


Bruce
Manjastre
Posts: 6
Joined: Fri Jul 29, 2016 11:43 pm
Location: Poole, UK

Re: Programmatically clear input text

Post by Manjastre »

Thanks for your reply.
I hadn't actually tried UNDEFINED (just "") unfortunatly setting it this way doesn't update the field in UI either.
It definitely sets the value to null though, which was useful to me for another purpose.
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: Programmatically clear input text

Post by tford »

unfortunatly setting it this way doesn't update the field in UI either.
You'll need to set auto-refresh for the BO.
Tom - V8.8 build 3137 - MySql / PostGres
mrbdrm
Posts: 349
Joined: Tue Oct 16, 2012 11:44 am

Re: Programmatically clear input text

Post by mrbdrm »

tford wrote:
unfortunatly setting it this way doesn't update the field in UI either.
You'll need to set auto-refresh for the BO.
I don't think he can.
Manjastre
Posts: 6
Joined: Fri Jul 29, 2016 11:43 pm
Location: Poole, UK

Re: Programmatically clear input text

Post by Manjastre »

I've tried refreshing by adding the process which resets SearchFilter to undefined to the autorefresh processes list.
Also adding RegularUser to the autorefresh object list. I've even tried refreshing every 60 seconds.

Perhaps there a way to drop keys in to the input buffer like Control A, Delete?
Manjastre
Posts: 6
Joined: Fri Jul 29, 2016 11:43 pm
Location: Poole, UK

Re: Programmatically clear input text

Post by Manjastre »

The solution I settled for was using DISPLAY LAYOUT to clear the input field and redisplay the tab.
I added the command $("#aw-static-input47705_0").focus(); in the tab render script to ensure the input field regained focus. The field was then ready for further user input.

This is only really suitable if you want to completely refresh all the panels. Note also that the DISPLAY LAYOUT command preserves the Context so you may want to put it in a different process.
pureist
Posts: 427
Joined: Sun Jan 24, 2016 10:00 pm

Re: Programmatically clear input text

Post by pureist »

Why not just have an Object called CustomSearch with an attribute 'Text' and display its very small stripped down form (transparent, no title, etc.) which has just the input box with a button following it?
The Banner frame could be arranged (using responsive - nested) to serve the same function as the Top Bar, and the form could display in one of its panels.
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: Programmatically clear input text

Post by tford »

Why not just have an Object called CustomSearch with an attribute 'Text' and display its very small stripped down form (transparent, no title, etc.) which has just the input box with a button following it?
The Banner frame could be arranged (using responsive - nested) to serve the same function as the Top Bar, and the form could display in one of its panels.
I do something very similar to this and it works very nicely. Allows auto-refresh to work as expected without DISPLAY LAYOUT.
Tom - V8.8 build 3137 - MySql / PostGres
pureist
Posts: 427
Joined: Sun Jan 24, 2016 10:00 pm

Re: Programmatically clear input text

Post by pureist »

Using an Object approach would mean you could also instead use a Query to display the search text entry field.
A Query is easier to strip down/make bare-bones than is a form.
The query would have inline editing enabled with an item operation button.
You could even save each custom search and build a history of what users are searching for if you wanted to be pedantic.
Manjastre
Posts: 6
Joined: Fri Jul 29, 2016 11:43 pm
Location: Poole, UK

Re: Programmatically clear input text

Post by Manjastre »

Re: Object method .. interesting. I shall try it.
Thanks for all your feedback
Post Reply