This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Dec 14, 2016, 7:51 PM
9 Posts
topic has been resolvedResolved

Basic Xpage help

  • Category: Dojo and Client Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 4

Hello folks,

 

I'm fairly new to XPages and I'm trying to do what I think should be a simple task but I can't seem to achieve it.  Perhaps someone could help me.

 

All I want to do is have a field for the user to input a name and then click "Search", which would find a match in the names.nsf and display it int he combo box.  I'm not sure how to get the button "Find" to refresh the combo box values

 

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
    <xp:table style="width:100.0%">
        <xp:tr>
            <xp:td>Name</xp:td>
            <xp:td>
                <xp:inputText id="Name" value="#{viewScope.first}" defaultValue="John"></xp:inputText>
                <xp:button value="Find" id="button1">
                    <xp:this.action>
                        <xp:actionGroup>
                            <xp:setValue
                                binding="#{viewScope.name}"
                                value="" />
                        </xp:actionGroup>
                    </xp:this.action>
                </xp:button>
            </xp:td>
        </xp:tr>

        <xp:tr>
            <xp:td>User Match</xp:td>
            <xp:td>
                <xp:comboBox id="Color" value="#{view2}">
                    <xp:selectItem itemLabel="Select One" id="selectItem1"></xp:selectItem>

                    <xp:selectItems>
                        <xp:this.value><![CDATA[#{javascript:var dbname =new Array("", "names.nsf");
var txtControlValue = getComponent("Name").getValue();
return @DbLookup(dbname,"$VIMPeople",txtControlValue, 1, "[PARTIALMATCH]")}]]></xp:this.value>
                    </xp:selectItems>
                </xp:comboBox>
            </xp:td>
        </xp:tr>
    </xp:table>
</xp:view>

 

Thank you in advance for your help :)

Rony

Dec 15, 2016, 10:07 PM
586 Posts
umm

Rather then saying please ignore..  it would be better if you posted your own solution.  Then it would have chance to help others in the future.

 

Just a suggestion.

 

Dec 16, 2016, 3:23 PM
298 Posts
*and don't cross post, you also put this in the 8.5 forum
Dec 22, 2016, 3:42 PM
9 Posts
Solution

You are correct, I should have posted a solution.

I created a search field for the user to enter a name to search.

    <xp:table rendered="#{javascript:document1.isNewNote()}"
        style="width:25.0%" styleClass="searchPanel">
        <xp:tr>
            <xp:td>
                <xp:label value="Name:" id="Name_Label1" for="Name"></xp:label>
            </xp:td>
            <xp:td>
                <xp:inputText id="Name" defaultValue=""></xp:inputText>
                <xp:button value="Search" id="button4">
                    <xp:eventHandler event="onclick" submit="true"
                        refreshMode="partial">
                    </xp:eventHandler>
                </xp:button>
            </xp:td>
        </xp:tr>
    </xp:table>
    <xp:br></xp:br>

 

then I added a combox that displays the names that matches the search query.

    <xp:table>

        <xp:tr>
            <xp:td>Username</xp:td>
            <xp:td>

                <xp:comboBox value="#{document1.Username}" id="comboBox1">
                    <xp:selectItems id="selectItems1">
                        <xp:this.value><![CDATA[#{javascript:var dbname =new Array("", "names.nsf");
var txtControlValue = getComponent("Name").getValue();
if (txtControlValue == '') {
    return null;
} else {
    getComponent("userInfo").setRendered(true);
    return @DbLookup(dbname,"$VIMPeople",txtControlValue, 1, "[PARTIALMATCH]");
}}]]></xp:this.value>
                    </xp:selectItems>
                    <xp:eventHandler event="onchange" submit="true"
                        refreshMode="partial" id="eventHandler1">
                        <xp:this.action>
                            <xp:setValue binding="#{viewScope.username1}"
                                value="#{javascript:this.parent.getValue()}">
                            </xp:setValue>
                        </xp:this.action>
                    </xp:eventHandler>
                </xp:comboBox>
            </xp:td>
        </xp:tr>
    </xp:table>

 


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal