191 Lotus blogs updated hourly. Who will post next? Home | Blogs | Search | About 
 
Latest 7 Posts
HTML5 Canvas to PNG via RPC
Tue, Jun 21st 2016 2
Eternal fustrations with IBM "Help" - - this time trying to give them money
Mon, May 23rd 2016 6
Simple Example: Bootstrap
Tue, May 3rd 2016 2
Import CSVs into a Notes/XPage database
Thu, Mar 24th 2016 3
REST via Service Bean
Tue, Feb 16th 2016 5
Reversing the display order of a Multi-value field (XPages)
Wed, Jan 13th 2016 3
nhttp preview won't "switch ID"
Mon, Dec 7th 2015 5
Top 10
dataTable with Categories
Tue, Jul 14th 2015 7
Eternal fustrations with IBM "Help" - - this time trying to give them money
Mon, May 23rd 2016 6
Archive of my last Blog
Wed, Jun 3rd 2015 5
nhttp preview won't "switch ID"
Mon, Dec 7th 2015 5
REST via Service Bean
Tue, Feb 16th 2016 5
Populate an InputText Date field (that has a calendar picker)
Fri, Jun 26th 2015 4
New blog
Wed, Jun 3rd 2015 4
dataTable column width
Tue, Jul 14th 2015 4
Bootstrap Progress Bars - sample database
Wed, Aug 12th 2015 4
DirectoryNavigator via Java
Wed, Nov 4th 2015 4


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
2
HTML5 Canvas to PNG via RPC
Tue, Jun 21st 2016 1:21p   Brian M. Moore
Declan Lynch provided a Signature Capture Control on OpenNTF some time ago. I had downloaded and played with it a bit, but hadn't had a production use for it, but it worked just like it said on the tin - drop it in and use it. Recently I was asked to come up with a way to let people sign into an event using tablets, so a perfect opportunity to pull it out. It was a breeze to add it to the sign-in portion, we display a page on a mobile device and the user can sign in on the canvas. That was the
6
Eternal fustrations with IBM "Help" - - this time trying to give them money
Mon, May 23rd 2016 11:22a   Brian M. Moore
So I find I need to purchase a Domino license again, this happens for independent developers. I make my selection and get taken to what IBM is now calling the "Marketplace" to check out. However the option to enter a credit card to actually pay for my purchase is greyed out. So I call in. There is a wait and a lady answers. She asks the typical questions and then for me to send them an email with a screen shot. I ask for a ticket number so I can track this request (my reopened ticket for Bluem
2
Simple Example: Bootstrap
Tue, May 3rd 2016 8:23p   Brian M. Moore
The Bootstrap library is a great way to do responsive design, and it's been incorporated into the Extension Library so you can use it "out of the box". The problem I've found is that the samples provided are pretty complex. Not too helpful if you are starting out since you have to try to figure out callbacks and a lot of other stuff to get to the points you want. I think overly complex starter examples are a waste. They let the creator think they have provided something without actually hel
3
Import CSVs into a Notes/XPage database
Thu, Mar 24th 2016 9:17p   Brian M. Moore
We have not had a direct way to import into Notes since it became impossible to save a file in .123 format (or .wk4). I loved being able to import from a view. To work around this, some years ago I created an agent that used MSExcel and two files. That worked when I had MSExcel on my machines, but I don't any more, especially for my personal machines where I won't pay for it. So I needed to change to to import CSV files, which I can do via LibreOffice. So I updated what I had posted in 2009.
5
REST via Service Bean
Tue, Feb 16th 2016 10:36p   Brian M. Moore
This is based on Custom REST service in Xpages using a service bean by Stephan Wissel. But it doesn't show actually getting prints from the method sent. My work partner Brian Hester and I both tried at the same time and ended up getting it at the same time – we actually started IM-ing each other that we had it. And this is the day before Bernd Hort posted his presentation. So to intercept the REST methods, so you can get prints like this: 02/11/2016 09:06:26 AM HTTP JVM: renderService02/11




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