Posted by Robert Graham
2016-08-18

I have 2 questions for you. First now can I have a default field answer? For example 95% of the people in my data base will share the same City, State and Zip. Having to a default answer will save retyping everything for each person.
Second do you have any examples of how to format the php to print out the data from a sql record for example print a mailing label.
Posted by Tom
2016-08-19

To set a default value, open web/codelib/df.fl.(table-name).inc.php and find the field definition array you want to edit. For example, this is the field definition of first_name :
'first_name'=>array(
XA_CLASS=>'CVText',
XA_CAPTION=>RSTR_FIRST_NAME,
XA_REQUIRED=>false,
XA_SIZE=>24,
XA_MIN_CHAR=>0,
XA_MAX_CHAR=>36,
XA_SEARCH_OP=>'s%',
XA_LIST=>'(sp)(sr)(fd)',
),
Insert the following line to the array:
XA_INIT_VALUE=>array( 'reg'=>'enter-default-value-here' ),
The result should look like:
'first_name'=>array(
XA_INIT_VALUE=>array( 'reg'=>'enter-default-value-here' ),
XA_CLASS=>'CVText',
XA_CAPTION=>RSTR_FIRST_NAME,
XA_REQUIRED=>false,
XA_SIZE=>24,
XA_MIN_CHAR=>0,
XA_MAX_CHAR=>36,
XA_SEARCH_OP=>'s%',
XA_LIST=>'(sp)(sr)(fd)',
),
enter-default-value-here will be the default value of first_name.

>Second do you have any examples of how to format the php to print out the data from a sql record for example print a mailing label.

Sorry I don't have any code snippets for that.