PDA

View Full Version : Multi select list box


ABC123

Bill Parker
04-15-2007, 11:54 PM
I have had a struggle with a multi select list box on a dialog component. The documentation has not been particularly helpful, but at least the msg board archive got me partial success. I am stuck on validating that a selection has been made. In the validation section I have tried

CurrentValue <> ""
and
CurrentValue.dump()<>""

neither of those work. In the AfterValidate, the following code does save the correct value to a table.


list = campus.dump()
list = crlf_to_comma(list)
tPerson.Campus = list


I just need to validate that a selection has been made, and no, I do not want to set an initial value.

Bill.

csda1
04-16-2007, 01:25 AM
Bill,

I don't find the documentation particularly helpful either for the things I try to do. Most of the time, I find similar ones in the Learning Xdialog database, or use the genie to generate something close, then I modify it.

Can you post some code?

Bill Parker
04-16-2007, 01:42 AM
Since this is a web component it is more difficult to post code. The original msg has the single line of code (2 different tries) that is the validation property that is not working for me.

I have a multi-select drop down variable called Campus in the dlg component. The result of the variable is an array, although the doc I was reading for the first couple hours said it was a character. But in the validation section you supposedly use the reference "CurrentValue", which is always a character?

Just not sure how to check it.

Bill.

Pat Bremkamp
04-16-2007, 10:46 AM
Bill,

Here is what I think I know about your issue.

It seems like the multiselect creates an array (in your case campus[]) and always creates at least one element.

So, the way I validate that something was selected is:

if alltrim(campus[1])="" 'nothing selected

Don't know if that's the best way, but it seems to work for me. Obviously, it will fail if a blank entry is selected, but that's another issue.

Pat

Bill Parker
04-16-2007, 11:28 AM
Thanks Pat,

I'll give that a try. You put that in the Validate event for the form? It does not work as a custom validation for the validate property of the variable.

So if it is in the validate event, you don't use any of the CurrentForm... stuff?

Bill.