Script load combo boxes

Script load combo boxes

Postby smhaigh » Mon May 21, 2007 11:01 pm

On my validation form I have 2 combo boxes. The first one has a selection of data and the data in the second one depends on the value selected in the first one (cascading combo boxes).

I can get the data from the database but for the life of me I can't work out how to load that data into the combo boxes.

Its probably something really easy.

Thanks
Simon
smhaigh
Participant
 
Posts: 17
Joined: Sun Feb 04, 2007 6:55 pm
Location: Australia

Postby stephan_mayer@kofax.com » Tue May 22, 2007 2:56 am

Very good question, it is easy when you know the trick. Just assign the values to the text property of the combo field, and use a pipe symbol | (if | is your delimiter as specified in the control settings) to separate the values, e.g.
Code: Select all
Dim oMyCombo As CscXDocField
Set oMyCombo = pXDoc.Fields.ItemByName("MyCombo")
oMyCombo.Text = "Value 1|Value 2|Value 3"
Hope this helps!
Last edited by stephan_mayer@kofax.com on Tue Jun 12, 2007 6:31 am, edited 1 time in total.
Best Regards,<BR>
Stephan Mayer
Presales Manager EMEA
Kofax Image Products
stephan_mayer@kofax.com
Participant
 
Posts: 350
Joined: Wed Jan 28, 2004 3:40 am
Location: Germany

Postby smhaigh » Tue May 22, 2007 2:19 pm

Stephen

Thanks for this but unfortunately it doesn't seem to work.
All I get is "Value 1|Value 2|Value 3" displayed as one item.

Settings for the field:
Combobox Behaviour: Free Content
Combobox Style: Fill in Script
Delimiter: |
Dictionary: <blank>

Anything else I might have missed?
smhaigh
Participant
 
Posts: 17
Joined: Sun Feb 04, 2007 6:55 pm
Location: Australia

Postby stephan_mayer@kofax.com » Tue May 22, 2007 2:51 pm

Your combo settings are correct. Sorry, I was posting too quick. You need to assign the value list to the variable ComboboxItems in function ValidationForm_BeforeComboBoxDropDown:
Code: Select all
Private Sub ValidationForm_BeforeComboBoxDropDown(ByVal ComboboxName As String, pXDoc As CASCADELib.CscXDocument, ComboboxItems As String)
   Select Case ComboboxName
      Case "MyCombo"
         ' initialize combo box with values
         ComboboxItems = "Value 1|Value 2|Value 3"
   End Select
End Sub

That should do the trick now...
Best Regards,<BR>
Stephan Mayer
Presales Manager EMEA
Kofax Image Products
stephan_mayer@kofax.com
Participant
 
Posts: 350
Joined: Wed Jan 28, 2004 3:40 am
Location: Germany

Postby smhaigh » Tue May 22, 2007 3:08 pm

Stephan

Thanks for that. Works perfectly

Simon
smhaigh
Participant
 
Posts: 17
Joined: Sun Feb 04, 2007 6:55 pm
Location: Australia

Postby pschokker » Tue Dec 11, 2007 2:12 am

thank you for this post :)

I have an aditional question.
I'm trying to 'transform' a field to a combobox fieldtype with a script (in xtrata Pro 3.1)

So instead of defining the comboboxes manually in the validation form gui, I would like to do it from script. Is this possible at all? It will save me lots of time.

It seems that I have a hard time finding it....
pschokker
Participant
 
Posts: 44
Joined: Thu Sep 13, 2007 4:40 am

Postby wolfgang.radl@kofax.com » Tue Dec 11, 2007 3:14 am

You can't change an object during runtime. You can access things like:
Project.ClassByID(1).ValidationForm.ValidationFields.ItemByIndex(0).FieldName

but you can not change them.

Why not using a combobox everytime and fill it from script in the before dropdown event?
Kind Regards,
Wolfgang Radl
KOFAX Sales Engineer
wolfgang.radl@kofax.com
Participant
 
Posts: 453
Joined: Sun Oct 09, 2005 10:52 pm
Location: Vienna, Austria

Postby pschokker » Mon Jan 07, 2008 4:09 am

Wolfgang_Radl@dicomgroup.at wrote:Why not using a combobox everytime and fill it from script in the before dropdown event?


Simple. When you have a validation form with 20 fields and screw something up, you have to redefine the complete form, including all the clicks to make comboboxes and their settings. That's a lot of work.

It would be much easier to let the form be created on the fly by script.

An undo button would be a great thing in the form editor :)
pschokker
Participant
 
Posts: 44
Joined: Thu Sep 13, 2007 4:40 am

Postby wolfgang.radl@kofax.com » Wed Jan 09, 2008 1:35 am

Oh yes, I agree on that.
Kind Regards,
Wolfgang Radl
KOFAX Sales Engineer
wolfgang.radl@kofax.com
Participant
 
Posts: 453
Joined: Sun Oct 09, 2005 10:52 pm
Location: Vienna, Austria

How to default a combobox to an item in the list

Postby geo2tc » Wed Dec 03, 2008 5:33 pm

This is a good discussion :?
What I am trying to do at this point is to default my combobox using script to one of the item in the "comboboxitems" field. I am using a similar code as earlier
Code: Select all
Private Sub ValidationForm_BeforeComboBoxDropDown(ByVal ComboboxName As String, pXDoc As CASCADELib.CscXDocument, ComboboxItems As String)
   Select Case ComboboxName
      Case "Currency"
         ComboboxItems = "CAD;EUR;USD"
   End Select
End Sub

Any idea?
User avatar
geo2tc
Participant
 
Posts: 6
Joined: Tue May 06, 2008 10:55 am
Location: Atlanta

Re: Script load combo boxes

Postby dilipnikam » Tue Mar 03, 2015 11:05 pm

I have a very similar requirement where i need default value in ComboBox along with drop down list also
For eg : By default in line item Combox field it will show 'USD' but it will also provide a list of present in dictionary.
dilipnikam
Participant
 
Posts: 40
Joined: Sun Jun 16, 2013 8:46 pm

Re: Script load combo boxes

Postby dkekesi » Wed Mar 04, 2015 8:44 am

It's as simple as setting combobox text to USD. Make sure USD is a valid selection (it's among the dropdown items).
Best Regards,

Daniel Kekesi
DocSoft Hungary
Image
dkekesi
Participant
 
Posts: 2569
Joined: Thu Dec 08, 2005 12:56 am
Location: Budapest, Hungary


Return to Kofax Transformation Modules General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron