I want to set a value on a field in a CiviCRM webform only when the form is submitted and not when saved as draft. The field is a CiviCRM field that appears in the webform but is not shown to the user.
The reason is I want to allow users to access and edit the information in the webform, but find a way of preventing them from accessing/editing the form once it has been "submitted". So I had created a yes/no field in Civi which I could set to yes when they submit the form and then prevent them from accessing the form if the value for the field was yes.
I was trying to set the value of the field using hook_webform_submission_presave but kept on getting errors. Not sure if this was because the form is split up into several pages and is using the "Save Draft" functionality. I'm not sure also if this is the right approach for CiviCRM enabled webforms.
This webform could be for either creating a new CiviCase record or editing an existing one.
Am open to suggestions of any other ways of preventing users from accessing the form after they have already submitted it.
I am using CiviCRM 5.3.1 with Drupal 7.59.