You are here

function formdefaults_edit_submit in Form Defaults 5

Same name and namespace in other branches
  1. 5.2 formdefaults.module \formdefaults_edit_submit()
  2. 6 formdefaults.module \formdefaults_edit_submit()

File

./formdefaults.module, line 310

Code

function formdefaults_edit_submit($formid, $form_values) {
  $formid = $form_values['formid'];
  $fieldname = $form_values['fieldname'];
  $formarray = formdefaults_getform($formid);
  $baseform = $formarray;

  // set the form values
  if ($form_values['type'] == 'markup') {
    $formarray[$fieldname]['value'] = $form_values['value'];
    $formarray[$fieldname]['format'] = $form_values['format'];
  }
  else {
    $formarray[$fieldname]['title'] = $form_values['title'];
    $formarray[$fieldname]['description'] = $form_values['description'];
  }
  $formarray[$fieldname]['hide_it'] = $form_values['hide_it'];
  $formarray[$fieldname]['weight'] = $form_values['weight'];
  $formdata = serialize($formarray);
  if ($baseform) {
    db_query('update {formdefaults_forms} set formdata=\'%s\'
             where formid=\'%s\'', $formdata, $formid);
  }
  else {
    db_query('insert into {formdefaults_forms}(formid,formdata) values (\'%s\',\'%s\')', $formid, $formdata);
  }
}