Page 1 of 1

Database driven textboxes - invalid values entered

Posted: Mon Apr 02, 2012 5:22 pm
by rajeevkushwaha
We have textboxes with database driven auto-complete. If user types in something that does not equate to a valid value in database and press' enter, a blank field value is sent back to RPG.

Now, some of our databases may have blank as a valid code value, in such case RPG would see incorrect entry as a valid blank value, misleading the user into believing that invalid value was accepted!
How can we handle such a scenario?

Re: Database driven textboxes - invalid values entered

Posted: Tue Apr 03, 2012 9:26 am
by David
You are correct, the auto complete box does not require the user to select from the values presented.

I'm not sure that I understand...

If you want to force the user to select from values presented, a drop down box is what you need.

If using an auto complete box, the program must validate what the user types into it.

Re: Database driven textboxes - invalid values entered

Posted: Tue Apr 03, 2012 11:07 pm
by rajeevkushwaha
I don't want to use drop-down box as my table file may have hundreds of values.

Here's the problem once again:
My textbox is defined with "choice options field" as CODE||' '||DESC, and "choice value field" as CODE.

Lets say user entered code as "QWERTY" - an invalid value

RPG receives blanks in the bound variable. Blanks happens to be a valid value, and hence passes the validation and is stored into the database as blanks.

Now, RPG doesn't know that user entered invalid value. To user it will appear as if "QWERTY" was accepted.

Re: Database driven textboxes - invalid values entered

Posted: Wed Apr 04, 2012 10:37 am
by David
When you are searching on the same field (or expression) that is used for the value, it then does return exactly what is typed into the box.

But, when used with different field/expression for value, it is then not clear what it should return to the program if the user has typed something which does not match. So it just returns blanks -- this is normal operation.

That said, I can understand your difficulty -- thanks for the additional explanation. I think a good long term solution is that we could add an optional property to the box that can be used to force the user to select a matching record or type an exact match. Maybe "force selection". If this property was turned on and they did not type/select a matching record, it would trigger a client-side validation message and control would not return to the RPG program.

I can discuss that with the development team.

In the meanwhile, here is one idea on how you can get around it...

You could concatenate some value onto the "choice value field", like this, maybe:

'X' || CODE

Then the bound "value" field would just have to be made long enough to accept the extra value. It can then remove it when the screen is submitted.

This way, you would know if you got all blanks that the user typed something invalid, as there would always be at least 'X' on a valid record selection.

Re: Database driven textboxes - invalid values entered

Posted: Wed May 02, 2012 2:49 pm
by MLC601
How about also adding an option to pass whatever the user types back to the RPG program?

Here's an example: Currently we have code values on some of our screens so many of our users know and use these. We're attempting to use database driven auto-complete on these fields looking for a match on the description and returning the code when selected. Many of our experienced users will not want to pick from a list, just enter the code.

As I understand it, I'll get blanks passed to the RPG program when this happens, correct? I'd like to have the keyed value passed back to the RPG.

Re: Database driven textboxes - invalid values entered

Posted: Thu May 03, 2012 10:00 am
by David
This sort of thing can be done today with the combo box widget. Have you tried this? This widget allows the user to either type in a value, or select from a list.

You get whatever they typed into the box, or the value selected from the list if they used it.

Re: Database driven textboxes - invalid values entered

Posted: Thu May 03, 2012 12:58 pm
by MLC601
That's a bit better, however, we really need this kind of option on the auto-complete also....some of our lists are very long and we'd prefer not to have our users scrolling through these lists unless they want to.....in fact, currently we have prompt programs that will show the entire list if the user so desires....

Thanks,

Mark