DeleteForm

<< Click to Display Table of Contents >>

 

DeleteForm

DeleteForm(formName, id, Callback)

This function deletes an answer from a Form. The formName parameter is the name of a Form object whose answer must be deleted and the id parameter is the unique identifier of an answer from this Form. The Callback parameter is a function that receives an asynchronous return of that operation. This function is called on the OnChange event of a Form and can be used to delete an answer as soon as it is sent to E3 or to EPM by using the WriteTag function. Example of use of this function on the OnChange event of a Form:

if (form.state == 2 /*finished*/)
{
  WriteTag("demo:TagInternal2",
    form.fields.campo.value,
      function (er)
        {
          if (!er)
            {
              /*if the answer was successfully written, delete*/
              DeleteForm("tasks",
                form.id,
                  function(er)
                    {
                      if (er)
                        {
                          LogMessage("Error removing: " + er);
                        }
                      });
                    }
          else
            {
              LogMessage("Error writing tag: " + er);
            }
        });
}

Was this page useful?