Add In-control Buttons to a TextBox

Description

You can place buttons inside a textbox control to clear entered text, search, filter, or run any number of customized actions or code.

images/ic7.png
An in-control 'Clear' button.
images/ic35.png
An in-control 'Search' button used to search a List.

To see a video explanation of the contents of this page watch this video.

Add a 'Clear' Button to a Textbox Control.

  1. In the UX Builder on the UX Controls page open the Data Controls menu. Click on the [TextBox] option to add a textbox to the component.

    images/ic.png
  2. Highlight the textbox. In the properties list under 'Textbox Properties' check the 'Custom in-control buttons' checkbox.

    images/ic2.png
  3. Click the button next to the 'In-control buttons definition' property.

    images/ic3.png
  4. In the In-control Buttons Builder click on 'Pre-defined buttons'. Select the 'Clear textbox entry' option.

    images/ic4.png
  5. Give the clear button a name, like 'clear', click OK

    images/ic5.png
  6. Click the button next to the Click action in order to see the Javascript that causes the clear button to actually clear text. Click OK and OK again.

    {this}.value = '';
    images/ic6.png
  7. Run in 'Live Preview'. Write some text into the textbox and click the 'clear' button. By default this is a simple x icon.

    images/ic7.png

Add a 'Search' Filter to a TextBox

  1. In the UX Builder on the UX Controls page open the 'Data Controls' menu and click on [List] to add a list control to the component.

    images/ic8.png
  2. Highlight the List control. In the properties list on the right click on the button next to the 'List properties' property, in the List Properties section.

    images/ic9.png
  3. In the List Builder's Data Source pane set the Data Source Type to 'SQL'.

    images/ic10.png
  4. Set the 'Connection string' property to be the 'Northwind' database.

    images/ic11.png
  5. From the 'Table name' property select the 'Customers' table.

    images/ic12.png
  6. Click on the button next to the 'Field list' property. Check the ContactName, Address, City, and Country fields.

    images/ic13.png
  7. Open the List Layout pane. Use the blue > arrow to move the four data fields from the Available Fields list to the Columns in List. Click OK to close the List Builder.

    images/ic14.png
  8. In the Data Controls menu click on [TextBox] to add a textbox control to the component

    images/ic15.png
  9. Highlight the textbox control. Use the blue up arrow in the Controls page toolbar to move the text box above the list control.

    images/ic16.png
  10. In the textbox control's properties list in the 'Textbox Properties' section check the 'Custom in-control buttons' property.

    images/ic17.png
  11. Click the button next to the 'In-control buttons definition' property.

    images/ic18.png
  12. Click the 'Add' button in the In-control Buttons Builder. Name the new button 'search' and click OK.

    images/ic19.png
  13. In the Button Definition section set the 'Type' property to 'Text'.

    images/ic20.png
  14. Set the 'Button text' property to 'Search'.

    images/ic21.png
  15. Check the "Use 'button' style" checkbox.

    images/ic22.png
  16. Click the button next to the 'Click action' property.

    images/ic23.png
  17. In the 'Edit Button Action' dialog click the 'Action Javascript' button. Choose the 'Create/Edit Javascript Option' action.

    images/ic24.png
  18. Click the 'Add New Action' button. Give the new action a name like 'searchList'.

    images/ic25.png
  19. Click the 'Edit Action' button.

    images/ic26.png
  20. Click the 'Add New Action' button.

    images/ic27.png
  21. From the 'Categories' list select 'UX Component'. In the Actions list select the 'Filter Record in a List Control' action.

    images/ic28.png
  22. In the 'Filter Records in a List Control' dialog set the 'List Control name' property to the list you defined, 'list1'

    images/ic29.png
  23. Check the 'Keyword search' property.

    images/ic30.png
  24. Set the 'Search input field' to the textbox control, 'textbox1'.

    images/ic31.png
  25. Click the button next to the 'Search fields' property and check the four data fields that were added to the List Control. Click OK, OK, OK, Save, and OK.

    images/ic32.png
  26. In the 'Edit Button Action' dialog click the 'Run a Javascript Action' button and select the action you defined, 'searchList' in this case. Click OK, OK, and OK again.

    images/ic33.png
  27. Run the component in Live Preview. Type something into the textbox control.

    images/ic34.png
  28. Click the Search button. The list control should filter to show any search results.

    images/ic35.png

See Also