Posted by Chris
2015-04-17

Hi,
I love this script (and the builder), great work!

I just have a tiny problem that really bugs me... I have a dropdown list and I don't know how to set the default option value. I tried to force it with HTML in the CVField.inc.php but didn't work so I came to think that this should be done via the field's array.
My array looks like:
'f0003'=>array(
XA_CLASS=>'CVSelection',
XA_CAPTION=>RSTR_F0003,
XA_REQUIRED=>false,
XA_MIN_CHAR=>0,
XA_MAX_CHAR=>12,
XA_SEL_TEXT=>SEL_F0003,
XA_SELECT_ON_TOP=>STR_SELECT_CAPTION,
XA_SEARCH_OP=>'s=',
XA_LIST=>'(sp)(sr)(fd)',
),
and I tried all possible variations I could think of for the XA_SELECT_ON_TOP value but nothing worked for me.

Any help appreciated! Thanks in advance!
Posted by Tom
2015-04-30

XA_INIT_VALUE will help you.
XA_INIT_VALUE=>array( 'reg'=>'--put-the-default-key-here--' ),
You need to replace "--put-the-default-key-here--" with the default key
you want to use. Insert the line to your array like this
'f0003'=>array(
XA_INIT_VALUE=>array( 'reg'=>'--put-the-default-key-here--' ),
XA_CLASS=>'CVSelection',
XA_CAPTION=>RSTR_F0003,
XA_REQUIRED=>false,
.....................
.....................
.....................
.....................