UserGuide

Difference between revisions of "Web Search Field"

From Xojo Documentation

 
Line 4: Line 4:
  
 
A Search Field does not do any searching; it is used to get the text for searching.
 
A Search Field does not do any searching; it is used to get the text for searching.
 
WebKit-based browsers such as Safari or Chrome may show a Recent Searches menu within this control. The searches on the Recent Searches menu are stored in a cookie and are specific to the name of the WebSearchField. For example, if you have two Web Search Fields with the name "SearchField1" in the same app, the user will see the same Recent Searches menu for both. However, if the two Web Search Fields have different names or are in different apps, the Recent Searches menu will not contain the same data.
 
  
 
Use the Set Default Value feature to specify the default text.
 
Use the Set Default Value feature to specify the default text.
Line 15: Line 13:
 
:Called when a key has been pressed while the field has focus. The Details parameters tells you which key was pressed. Remember that events such as this call back to the server to process the code. Due to latency between the browser and the server you do not want to have time consuming code in this event handler.
 
:Called when a key has been pressed while the field has focus. The Details parameters tells you which key was pressed. Remember that events such as this call back to the server to process the code. Due to latency between the browser and the server you do not want to have time consuming code in this event handler.
  
[[WebTextControl.TextChanged|TextChanged]]
+
[[WebTextControl.ValueChanged|ValueChanged]]
:Called when the text has been changed, but only after the user has pressed return, enter or the field has lost focus.
+
:Called when the user both changes the value and then either presses the return/enter keys, presses the search button that is built-in to the WebSearchField, cancels the entry by clicking the Cancel Entry button (X) that appears when the user types in the WebSearchField or by causing the WebSearchField to lose focus.
  
 
== Properties ==
 
== Properties ==
[[WebSearchField.CueText|CueText]]
+
[[WebSearchField.Hint|Hint]]
:Gets or sets the cue text (prompt text) that is displayed within the Text Field.
+
:Gets or sets the hint (prompt text) that is displayed within the control.
  
[[WebTextControl.Text|Text]]
+
[[WebTextControl.Value|Value]]
 
:Contains the text displayed in the text field.
 
:Contains the text displayed in the text field.
  
 
== Usage ==
 
== Usage ==
[[File:Web Toolbar.png|thumb|A Search Field displayed in a Web Toolbar]]
+
To get the text the user typed in the Search Field, use the Value property:
To get the text the user typed in the Search Field, use the Text property:
 
 
<rbcode>Var search As String
 
<rbcode>Var search As String
search = CustomerSearch.Text</rbcode>
+
search = CustomerSearch.Value</rbcode>
  
 
== See Also ==
 
== See Also ==

Latest revision as of 15:04, 25 August 2020

A Search Field is used for entering values that relate to searching. It operates similarly to a Text Field, but has a different look and extra features such a list of recently entered values and cue text.

A Search Field does not do any searching; it is used to get the text for searching.

Use the Set Default Value feature to specify the default text.

The commonly used events and properties are listed below. Refer to WebSearchField in the Language Reference for the complete list.

Events

KeyPressed

Called when a key has been pressed while the field has focus. The Details parameters tells you which key was pressed. Remember that events such as this call back to the server to process the code. Due to latency between the browser and the server you do not want to have time consuming code in this event handler.

ValueChanged

Called when the user both changes the value and then either presses the return/enter keys, presses the search button that is built-in to the WebSearchField, cancels the entry by clicking the Cancel Entry button (X) that appears when the user types in the WebSearchField or by causing the WebSearchField to lose focus.

Properties

Hint

Gets or sets the hint (prompt text) that is displayed within the control.

Value

Contains the text displayed in the text field.

Usage

To get the text the user typed in the Search Field, use the Value property:

Var search As String
search = CustomerSearch.Value

See Also

WebSearchField class; UserGuide:Web UI topic