Focal Point
setting a default in a drop-down

This topic can be found at:
http://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8321077331

February 18, 2004, 06:50 PM
webfocuspgm
setting a default in a drop-down
Users...? You never know what they'll like and not like. My user would like a particular value to be set as the default in the drop-down options. My focexec to create the drop-down looks like this:

FILEDEF YEARLST DISK YEARIS.HTM

-DEFAULT &TRANS = ' ';

TABLE FILE BU01TB06
SUM
COMPUTE YEARVAL/A8 =
IF CD_YEAR EQ '&TRANS' THEN 'SELECTED' ELSE ' ' ; NOPRINT
COMPUTE OPC/A128 =
'';
ON TABLE SET HOLDLIST PRINTONLY
BY CD_YEAR NOPRINT

ON TABLE HOLD AS YEARIS FORMAT ALPHA
END
-RUN

The drop down then has
All Years
2003
2004

My user wants the default to be set to current year. "All Years" comes from my HTML code and 2003/2004 comes from my focexec code.

Question is: How do I set a default selection ?
February 18, 2004, 09:07 PM
susannah
well, what works for me is to write my entire option list using focus defines
DEFINE FILE thing
PICK/A10=IF CDYEAR IS &SOMETESTVAL THEN ' SELECTED ' ELSE ' ' ;
OUTPUT/A100=
'';
END
TABLE FILE thing
PRINT OUTPUT BY CDYEAR NOPRINT
ON TABLE HOLD AS MYDDLIST FORMAT ALPHA
END
..and myddlist is filedefed into my site
..and my html page has 'ALL' with value $
as the first entry hardcoded into the page.
Then i reference this list

This works for an .asp launch page. if yours is html, you can issue a filedef at the top, make it a fex, and use !ibi.fil...but you know that already. Hope this helps; it works great for me.