'If this is the formatter rules for the Background Information
section then add the standard questions to the layout'

@staticmethod
def formatter_onaccept(form):

    s3db = current.s3db
    section_id = form.vars.section_id
    stable = s3db.survey_section
    section_name = stable[section_id].name
    if (section_name == 'Background    Information'):
        col1 = []
        ttable = s3db.survey_template
        template = ttable[form.vars.template_id]
        if (template.competion_qstn != ''):
            col1.append('STD-WHO')
        if (template.date_qstn != ''):
            col1.append('STD-DATE')
        if (template.time_qstn != ''):
            col1.append('STD-TIME')
        if ('location_detail' in template):
            col2 = ['STD-P-Code']
            location_list = json2py(template.location_detail)
            for loc in location_list:
                col2.append(('STD-%s' % loc))
            col = [col1, col2]
            rule = [{'columns': col}]
            rule_list = json2py(form.vars.rules)
            rule_list[:0] = rule
            rules = json.dumps(rule_list)
            db = current.db
            ftable = db.survey_formatter
            db((ftable.id == form.vars.id)).update(rules=rules)
