Clearing Form Field Values

When using ProcFormEdit you may have noticed that there’s an option called OverwriteWithNull. ProcFields is designed to not change fields if not provided and a quirk of that design is that sending an empty string as the value fell into this case as well.

To maintain compatibility we left that behavior in place and introduced back in RPM 16 the OverwriteWithNull option to allow API users to explicitly indicate that they do in fact desire to make the Field’s value an empty string. This option introduced it’s own set of quirks which make it’s usage confusing. So here’s a quick guide for clearing the value of fields.

There are multiple ways to clear a field’s value.

First, OverwriteWithNull must be set to true, there is no way to clear a field’s value without that option set to true.

There are multiple ways to clear a field’s value. We recommend explicitly using the first method, but we are documenting all the other so that API users can prevent issues by inadvertently using one of the others:

Sending “Value": null

{
    "Field": "Text Field",
    "Uid": "500_2",
    "Format": 7,
    "Value": null
}

Sending "Value" : ""

{
    "Field": "Text Field",
    "Uid": "500_2",
    "Format": 7,
    "Value": ""
}

Sending Value: "null" (this is means there is no way to set a field’s value to “null”, unfortunately)

{
    "Field": "Text Field",
    "Uid": "500_2",
    "Format": 7,
    "Value": "null"
}

Not sending a Value at all (this is undefined in the JavaScript world)

{
    "Field": "Text Field",
    "Uid": "500_2",
    "Format": 7
}

Tagged with: , ,
Posted in API Usage Examples
%d bloggers like this: