> For the complete documentation index, see [llms.txt](https://docs.fieldmotion.com/fieldmotion-api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fieldmotion.com/fieldmotion-api-docs/form/_edit.md).

# \_edit

Edits the data of a Form.

#### id

The ID of the Form being edited.

#### name

The name of the Form, the "|" character cannot be used when naming Forms.

#### email\_template\_id

The ID of an Email Template which the Form can use.

#### theme

The theme of the autodocs in the Form:

* blackwhite-normals
* bluestyle
* greenblue-single-border-foothead
* grey-borderless-edges
* greyback
* orange-thickbordery
* plain
* standard

#### type

The Form's type:

* 0=Job
* 3=Job Table
* 4=Quote
* 5=Purchase Order
* 6=Quote Table
* 7=Invoice
* 8=Invoice Table
* 9=Opportunities
* 10=Opportunities Table

#### replyto

The email address that replies to this Form will go to.

#### fields

An array for each question/field that the Form will have, includes several sub-variables for each field:

* name (string)
* type (What the field will be answered with. Suitable terms: input/signature/image/number/textarea/date/checkbox/barcode/combobox/select/\
  select-multiple/radio-block/radio-inline/textblock/assets/calculation/department/\
  geolocate/header-start/header-end/job/job\_notes/locations/matrix/schedule-of-rates/\
  suppliers/subform/tandc/users)
* sources (Defines a source for the question/field to be filled in by, taking a value from elsewhere
* visibility\_rules (Array of conditions for the question/field)\
  \[{"name":"test\_form\_edit","cond":"equals","type":"val","val":"test\_value","type2":"","val2":""}]
* hidden (integer value, 0 or 1)
* report (integer value, 0 or 1)
* readonly (Integer, sets if the question/field is editable "0" or read-only "1")
* required (integer value, 0 or 1)
* meta (has extra data,\
  e.g '{"id":1875260329706,"default\_value":"Default Answer","add\_to\_card":1}')
* extras\[values] (Extra information, can be used for choice options, calculations or ID arrays depending on the field type.)\
  Choice options: combobox/select/select-multiple/radio-block/radio-inline/\
  &#x20;                           textblock/tandc\
  &#x20;                           e.g "Yes\
  &#x20;                                  No"\
  Calculations:      calculation\
  &#x20;                           e.g "question1+question2"\
  ID Arrays:           job/subform\
  &#x20;                           e.g \["50012"]
* extras\[max-items] (Used if a field is set to the schedule-of-rates type)

#### onlyField

If this parameter is set to a value other than 0, autodoc data won't be modified.

#### report\_doc

An array of the autodocs data in the Form.

#### send\_notification

Sets if the Form will send out a notification. 1=no, 2=yes

#### do\_not\_update\_stock\_levels

Parameter that if set to 1 prevents Stock levels being updated if a Stock is linked to a Job with this Form.

#### slots

Sets the slot data for the Form through a few variables:

If the slots are enabled, how many per day, minimum days of notice, and an array of what days the slots are on, from Sunday to Saturday

e.g {"enabled":1,"slots":2,"notice":1,"days":\[0,1,1,0,1,0,0]}

#### required\_skills

An array of set Skill IDs required for this Form.

#### onComplete

The instructions data for what will happen when the Form is completed.

### Example

```
FM_Api('Form_edit',[
    'id'=>'330002',
    'name'=>'Test Of Form',
    'type'=>'0',
    'required_skills'=>["60001"],
    'replyto'=>'test_emailaddress@gmail.com',
    'do_not_update_stock_levels'=>'1',
    'fields'=>[
                [
                'name'=>'question_test1',
                'type'=>'users',
                'sources'=>'[{"form_id":"job","field":"user_id"}]',
                'visibility_rules'=>'[{"name":"test_form_edit","cond":"equals","type":"val","val":"test_value","type2":"","val2":""}]',
                'hidden'=>'1',
                'report'=>'1',
                'readonly'=>'1',
                'required'=>'1',
                'meta'=>'{"id":1875260329706,"default_value":"default_test_value","add_to_card":1}'
                ],
                [
                'name'=>'question_test2',
                'type'=>'tandc',
                'sources'=>[],
                'visibility_rules'=>[],
                'meta'=>'{"id":1814844904225}',
                'extras'=>['values'=>'test terms']
                ]
            ],
    'slots'=>'{"enabled":0,"slots":1,"notice":3,"days":[1,1,1,0,0,0,0]}',
    'send_notification'=>'2',
    'email_template_id'=>'242001',
    'onComplete'=>'[{"name":"default","constraints":[{"type":"if","field":"test_form_edit","condition":"equals","value":"test condition","hide":0,"constraints":[{"type":"doNothing"}]},{"type":"createAppointment","days":0,"days_frequency":1,"days_base":"","days_time":"","days_weekend":"","department_id":"","form_id":760373,"job_type":242003,"priority":"2","is_complete":0,"user_id":92447,"copy":["job_ref"],"copy_form_values":[],"copy_table_values":{},"customer_id":"","hours":1,"constraints":[]},{"type":"doNothing"}]}]',
    'report_doc'=>'{"header":"","body":"<table cellpadding=\"2\" style=\"border-collapse:collapse;width:100%;border: 1px solid black;\"><tbody><tr><td style=\"border: 1px solid black;\">test_form_edit<\/td><td style=\"border: 1px solid black;\"><fm class=\"fm_ck_form fm_ck_widget\" contenteditable=\"false\" data-type=\"ff_1875260329706\" style=\"width:120px;height:15px\">ff_1875260329706<\/fm><\/td><\/tr><\/tbody><tfoot><\/tfoot><\/table><p><\/p>","footer":""}'
 ]);
```

### Results

#### On Success

```
{"form":"330002","ok":1}
```

#### On Failure

If the "id" parameter has an integer value less than 0:

```
{"error":"missing or invalid parameter: id"}
```

If the "name" parameter is not set:

```
{"error":"missing or invalid parameter: name"}
```

If the "name" parameter uses the "|" character at all:

```
{"error":"you cannot use the | symbol in your form name"}
```

If the "id" parameter does not match an existing form:

```
{"error":"form does not exist"}
```
