203 Lotus blogs updated hourly. Who will post next? Home | Blogs | Search | About 
 
Latest 7 Posts
HCL and IBM Partner on Domino 10
Wed, Oct 25th 2017 5
Importing CSV via Java to a Notes Database
Fri, Aug 11th 2017 1
HTML5 Canvas to PNG via RPC
Tue, Jun 21st 2016 4
Eternal fustrations with IBM "Help" - - this time trying to give them money
Mon, May 23rd 2016 2
Simple Example: Bootstrap
Tue, May 3rd 2016 2
Import CSVs into a Notes/XPage database
Thu, Mar 24th 2016 2
REST via Service Bean
Tue, Feb 16th 2016 6
Top 10
dataTable with Categories
Tue, Jul 14th 2015 6
REST via Service Bean
Tue, Feb 16th 2016 6
Reversing the display order of a Multi-value field (XPages)
Wed, Jan 13th 2016 5
HCL and IBM Partner on Domino 10
Wed, Oct 25th 2017 5
Bootstrap Progress Bars - sample database
Wed, Aug 12th 2015 4
nhttp preview won't "switch ID"
Mon, Dec 7th 2015 4
HTML5 Canvas to PNG via RPC
Tue, Jun 21st 2016 4
dataTable column width
Tue, Jul 14th 2015 3
DirectoryNavigator via Java
Wed, Nov 4th 2015 3
ComboBox - Validate so default value is not selected
Wed, Jul 1st 2015 2


ComboBox - Validate so default value is not selected
Twitter Google+ Facebook LinkedIn Addthis Email Gmail Flipboard Reddit Tumblr WhatsApp StumbleUpon Yammer Evernote Delicious
   

One of the things that I've been trying to get to work in XPages is getting validation to reject the default value of a combobox. Well, this morning I sat down and decided to get it done. I've used other methods to get around this until now, but this seems to do it.

I have a combobox with "--Select--" as the default value. If that value is still there on submission, I want a display error control to execute. To do this, I think you need to have "--Select--" as the itemValue as well as the itemLabel, but I'm not sure, as I habitually use both anyway.

Add a validateContraint, and use the RegEx "^((?!--Select--).)*$" , I got this from this StackOverflow Post. So on submission, if a value hasn't been selected (errm, sorry) no dice.

I tested on a combobox that needed the user to select the month, the entire element is below.

There may be a better way, but having this will be a relief for me.

Cheers,
Brian
                    <xp:comboBox
                        id="comboBox1"
                        value="#{document1.rptCover}"
                        style="width:125.0px"
                        defaultValue="--Select--">

                        <xp:this.validators>                           
                            <xp:validateConstraint
                                regex="^((?!--Select--).)*$"
                                message="Select a month">
                            </xp:validateConstraint>
                        </xp:this.validators>
                        <xp:selectItem
                            itemLabel="--Select--"
                            id="selectItem15" itemValue="--Select--"/>

                        <xp:selectItem
                            itemLabel="January"
                            itemValue="January"
                            id="selectItem1" />

                        <xp:selectItem
                            itemLabel="February"
                            itemValue="February"
                            id="selectItem2" />

                        <xp:selectItem
                            itemLabel="March"
                            itemValue="March"
                            id="selectItem3" />

                        <xp:selectItem
                            itemLabel="April"
                            itemValue="April"
                            id="selectItem4" />

                        <xp:selectItem
                            itemLabel="May"
                            itemValue="May"
                            id="selectItem5" />

                        <xp:selectItem
                            itemLabel="June"
                            itemValue="June"
                            id="selectItem6" />

                        <xp:selectItem
                            itemLabel="July"
                            itemValue="July"
                            id="selectItem7" />

                        <xp:selectItem
                            itemLabel="August"
                            itemValue="August"
                            id="selectItem8" />

                        <xp:selectItem
                            itemLabel="September"
                            itemValue="September"
                            id="selectItem9" />

                        <xp:selectItem
                            itemLabel="October"
                            itemValue="October"
                            id="selectItem10" />

                        <xp:selectItem
                            itemLabel="November"
                            itemValue="November"
                            id="selectItem11" />

                        <xp:selectItem
                            itemLabel="December"
                            itemValue="December"
                            id="selectItem12" />
                    </xp:comboBox>


---------------------
http://dominoherald.blogspot.com/2015/07/combobox-validate-so-default-value-is.html
Jul 01, 2015
3 hits



Recent Blog Posts
5
HCL and IBM Partner on Domino 10
Wed, Oct 25th 2017 10:27p   Brian M. Moore
I was excited to see the announcement about HCL and IBM working on Domino 10 in 2018. The thing I want most out of this is a focus on Sales, even more than I want most of the changes that could come from new elements to work with. Domino has a very mature NoSQL datastore that has a lot of built-in functionality. I think if an emphasis was put on that and whatever sales teams exist pushed the product there would be an upturn in the user base. If they would make it worth the financial while of sa
1
Importing CSV via Java to a Notes Database
Fri, Aug 11th 2017 8:35p   Brian M. Moore
It's been longer than I intended since my last post, but here it is. One of the things I've posted has been importing to a Notes database. My first was using LotusScript to import from an Excel file, I've moved to using CSV which does not require an external program. This one uses a Java bean and HashMap to map the field names. As with the others, this takes two files. First is a simple where the you have the data. The column titles will match up with the same row in a title spreadsheet. Th




Created and Maintained by Yancy Lent - About - Planet Lotus Blog - Advertising - Mobile Edition