'Edit the form fields defining a library template'

def edit_template(self, cntrller, item_type, form_type, library_id, field_type, field_label_1, field_helptext_1, field_default_1, folder_id='', ldda_id='', action='add_field'):

    params = dict(cntrller=cntrller, item_type=item_type, form_type=form_type, library_id=library_id)
    self.visit_url('/library_common/edit_template', params=params)
    self.check_page_for_string('Edit    form    definition')
    if (action == 'add_field'):
        tc.submit('add_field_button')
        tc.fv('edit_form', 'field_label_1', field_label_1)
        tc.fv('edit_form', 'field_helptext_1', field_helptext_1)
        if (field_type == 'SelectField'):
            self.refresh_form('field_type_1', field_type)
        else:
            tc.fv('edit_form', 'field_type_1', field_type)
        tc.fv('edit_form', 'field_default_1', field_default_1)
    tc.submit('save_changes_button')
    self.check_page_for_string('The    template    for    this    data    library    has    been    updated    with    your    changes.')
