Wednesday, 29 August 2018

Email Submit Restrictions

1. To apply restriction in a form which needs to pass before submit.
2. If the user cancels the submit process then perform post submit operation and validate again.

Verifying the restrictions is easy in the form, but to capture the control after a user clicks on Submit is tricky.

In my example, I am verifying the Phone Number on submit and hiding the Submit Button itself.
The scenario is that the form can only be submitted once.

However, if the user clicks on Submit Button and cancel the draft email for any reason then the whole process should be nullified and Submit Button should remain active.

This can be done by using the try catch block. And after capturing the specific exception of user cancelled operation, we can perform post submit operation.

Submit Cancelled

var eid = "";
var sub = "This is a dummy Subject Line";
var bdy = "Sample Body";

if(TextField1.rawValue == null || TextField1.rawValue == "" || TextField1.rawValue.length != 10)
app.alert("Please enter correct phone number");
if(TextField1.rawValue.length == 10)
this.presence = "hidden";{cURL:"mailto:" + eid + "?subject=" + 'Anoop &amp Singh' + "&body=" + bdy ,cSubmitAs:"PDF",cCharset:"utf-8"});


if(e.toString() == "RaiseError: User canceled operation.")
this.presence = "visible";


No comments:

Post a Comment