Using Special Characters in Your Dropdown Boxes

Have you ever wanted to pull out your hair when trying to map a dropdown box with non-alphanumeric characters in it?  It happens all the time: someone builds an order with a prompt that has a greater-than (>) or less-than (<) sign, a comma (,), a plus (+), an equal sign (=), an "at sign" (@), a colon (:), or other "sacred" characters.

Let's look at some examples:

Colon Use:


Plus Sign Use:



Avoiding the Issue in the First Place

I've heard that some sites go through the process of updating their prompts and allowed / recommended value lists in the toolkit to change "OTHER: SEE COMMENTS" to "OTHER - SEE COMMENTS" or "65+" to "65 or older" and that is a viable option, but can be time consuming.

(NOTE: if your facility is still in the early stages of setting up HEO, do yourselves a favor and avoid these characters as a rule. The best practice is to avoid these issues in the first place)

What the Issue is and Why This Happens

When the iForm gets submitted, the values in your form elements go through a process known as URI Encoding. Your alphanumeric characters won't be affected, but "special" characters will often be encoded using this process.

When data that has been entered into HTML forms is submitted, the form field names and values are encoded and sent to the server in an HTTP request message using method GET or POST, or, historically, via email. The encoding used by default is based on a very early version of the general URI percent-encoding rules, with a number of modifications such as newline normalization and replacing spaces with "+" instead of "%20". The Internet media type of data encoded this way is application/x-www-form-urlencoded, and it is currently defined (still in a very outdated manner) in the HTML and XForms specifications. (Wikipedia)

How to Work Around the Issue

Since VGR can deal with these special characters within itself, we just need to pass a value from the HTML to the VGR that does not get impacted by the URI encoding.  Then, in our VGR, we check for those specific value(s) and set it "back" to what it was originally.  Going back to our examples above:

Colon Use:

HTML


VGR

EDIT,IF,,cboExample1,EQ,"OTHER",THEN
EDIT,SET,,cboExample1,TO,"OTHER: SEE COMMENTS"

EDIT,IF,,chkExample1,EQ,"true",THEN
EDIT,SET,,orderstring,CAT,"@LOAD_ORDER=OIS=11111^^^OOS=0^^^111=`cboExample1"

Plus Sign Use:

HTML


VGR

EDIT,IF,,cboExample2,EQ,"65 plus",THEN
EDIT,SET,,cboExample2,TO,"65+"

EDIT,IF,,chkExample2,EQ,"true",THEN
EDIT,SET,,orderstring,CAT,"@LOAD_ORDER=OIS=22222^^^OOS=0^^^222=`cboExample2"

This code here just changes the value in the dropdown box variable to be just as if it had originally contained the characters, but since we're adding back the special characters from within the VGR it does not go through the URI encoding process and can be used just like any other variable.

Further Reading

Scott Morris is available for training, mentoring, troubleshooting, and iForms consulting. Find out more at www.thinkiforms.com

Milestones and Accomplishments

It's pretty amazing to be able to say this, but we just recently hit 10,000 views on this blog.  I know in the grand scheme of things, that's a drop in the bucket to what many sites get; some have gotten 10,000 hits in the span of time that it's taken for you to read this far into the post.  However, I still feel that it's an accomplishment worth noting.

Visit thinkiforms.com for
more information

Another accomplishment worth noting is that I've made the leap. You know, THE leap from working for a hospital to working as a consultant, and finally, now, for myself.  I've started a new company, "Think iForms, LLC" and am currently personally available to consult for short-term, long-term, or even in a mentoring role.  Do you want to get "Feature X" working?  Give me a call.  My contact information can be found on my website.

And you heard it here first, I am licensing my software that can Automatically Convert an HEO Outline to a VGR iForm.  This is a game changer that can catapult your sites in the speed and sheer number of iForms that you will be able to produce.  I'm piloting the software now; if you would like to be included in the pilot program or would like to see a working demo, contact me at scott@thinkiforms.com.  This is a limited time (and limited number of sites) pilot, so act now.