Skip to main content link. Accesskey S
  • Anonymous
  • Log on
  • Help
  • IBM logo
  • Lotus Notes and Domino Application Development wiki
  • All Wikis
  • Home
  • Community Articles
  • Product Documentation
  • Learning Center


Search

Advanced Search

Categories

Tag Cloud

  • 6.0
  • 6.5
  • 8.0
  • 8.5
  • 8.5.1
  • 8.5.2
  • 8.5.3
  • action bar
  • Agents
  • Ajax
  • app dev
  • Application
  • beginner
  • C&S
  • calendaring and scheduling
  • client
  • composite applications
  • Controls
  • converters
  • css
  • Custom controls
  • Data Binding
  • db2
  • design elements
  • dialog boxes
  • Documents
  • Dojo
  • Domino
  • Domino Designer
  • Domino Designer 8.5
  • DXL
  • Eclipse
  • error handling
  • errors
  • extensions
  • FAQ
  • Forms
  • formulas
  • getting started
  • globalization
  • Help
  • html
  • Installation
  • interface
  • internationalization
  • iPhone
  • Java
  • JavaScript
  • localization
  • Lotus Domino Designer
  • LotusScript
  • LotusSphere
  • LotusTechInfo
  • menu bar
  • Mobile
  • new user
  • Notes
  • Notes 8
  • notes.ini
  • NSD
  • OpenNTF
  • partial update
  • performance
  • Pickers
  • Portal
  • presentations
  • programming
  • Redbooks
  • Requested Articles
  • roadmap
  • rooms and resources
  • samples
  • Scripting
  • security
  • tabs
  • templates
  • themes
  • Tips
  • toolbar
  • troubleshooting
  • tutorials
  • validation
  • variables
  • video
  • VideoFest
  • View
  • view control
  • ViewPanel
  • Views
  • web
  • Web apps
  • Web services
  • webdev
  • XML
  • Xpage
  • XPages
  • XPages Extensibility API
  • xsp-config
  • データソース
  • 九州地区ノーツパートナー会
InformationInformation
You are currently viewing machine translated content. IBM translation might be available. Click IBM Translated Product Documentation to see what is available.X


Home > XPage Samples > XPages Type Ahead valueMarkup option
Rate this article 1 starRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

XPages Type Ahead valueMarkup option 

expanded Abstract
collapsed Abstract
No abstract provided.
The Type Ahead valueMarkup option is used when you want to do the entire server-side computation
of what appears in the type ahead dropdown for yourself, by computing the valueList property.

For example:
<?xml version="1.0" encoding="UTF-8"?> 
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"> 
Choose a model of car (try 'e' or 'm'):<xp:br></xp:br> 
<xp:inputText id="inputText1"> 
  <xp:typeAhead var="startValue" valueMarkup="true"> 
    <xp:this.valueList> 
      <![CDATA[#{javascript: 
        var cars = [ "Escape", "Explorer", "Focus" , "Mustang" , 
              "Thunderbird" , "Accord" , "Civic" , "Ridgeline" , 
              "Mazda 3" , "Mazda 6" , "RX-8" , 
              "Thomas The Tank Engine" ]; 
        var prices = [ "30", "55", "35" , "45" , 
              "20" , "20" , "35" , "50" , 
              "65" , "55" , "25" , "160" ]; 
        var result = "<ul>"; 
        for (i=0; i<12; i++) { 
          if( cars[i].toLowerCase().startsWith(startValue) ){ 
            result += '<li><span class="informal">Model: </span>' 
                   + cars[i] 
                   + '<span class="informal"><p style="color:green">'
                   +'price: ' 
                   + prices[i] 
                   + '</p></span></li>'; 
          } 
        } 
        return result + "</ul>"; 
      }]]> 
    </xp:this.valueList> 
  </xp:typeAhead> 
</xp:inputText> 
</xp:view>


In your Edit Box, in the Type Ahead tab, check the check box to enable Type Ahead.
In the Outline view, toggle open the Edit Box, select the child Type Ahead control.
In the All Properties tab, set "valueMarkup" to true. Set "var" as the name of
the value entered in the edit box so far. Then go back to the Edit Box, Type Ahead tab,
and compute the Suggestions to appear in the dropdown. The suggestions are saved
in the valueList property.

The valueList property should return a <ul> list, with 0 or more <li> items.
There are no further alterations to the result of the valueList property before it is sent to the browser.

Usually the valueList should filter the set of options to reflect the submitted value from the edit box,
by using the variable defined in the var property.
(Above it reduces the returned results to cars whose model starts with the edit box value,
but you could use this mechanism to do a "contains" check instead of startsWith.)

If you're displaying the results from a database column containing thousands of entries,
you should consider only sending the first few matches to the browser.

Your implementation is responsible for encoding and escaping values as needed.
For example, if using user-provided entries, ensure malicious users can't insert JavaScript tags
to be executed in other users' browsers.

Any style on the <ul> and <li> items are ignored when the result is processed in the browser (issue MKEE7R7JRZ, not fixed in 8.5.1),
but you can style the contents of the <li> items as much as you want;
only the innerText will be inserted into the edit box when an item is selected, so any HTML tags will not be inserted.

The <span class="informal"> mechanism is used to ignore portions of text from the displayed item
when inserting the value into the edit box. In the example above, type "e":

and select the first item. It will insert the text
    Escape 

into the edit box, instead of
    Model: Escape price: 30 

expanded Article information
collapsed Article information
Category:
XPage Samples
Tags:
8.5, ajax, XPages, TypeAhead

This Version: Version 8 July 2, 2010 10:19:52 AM by Maire Kehoe  IBMer

expanded Attachments (0)
collapsed Attachments (0)

 


expanded Versions (6)
collapsed Versions (6)
Version Comparison     
Version Date Changed by               Summary of changes
This version (8) Jul 2, 2010 10:19:52 AM Maire Kehoe  
7 Jul 2, 2010 10:18:51 AM Maire Kehoe  
6 Jan 13, 2010 6:09:46 AM Maire Kehoe  
5 Nov 18, 2009 1:05:21 PM Maire Kehoe  
2 Oct 19, 2009 5:51:35 AM Maire Kehoe  
1 Oct 29, 2009 1:43:37 PM Deanna Drschiwiski  
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedSubscribe to RSSHelpAbout
  • All Lotus and WebSphere Portal wikis
  • IBM developerWorks
  • IBM Software support
  • IBM Social Business User Experience Blog
  • IBMSocialBizUX on Twitter
  • IBMSocialBizUX on Facebook
  • Lotus product forums
  • IBM Social Business UX blog
  • IBM Collaboration Solutions
  • Recently added feedRecently added
  • Recently edited feedRecently edited
  • Recently added comments feedRecently Added Comments
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Contact IBM
  • IBM Terms of use
  • Wiki terms of use