Link to home
Start Free TrialLog in
Avatar of Infinity Solutions
Infinity SolutionsFlag for United States of America

asked on

Can you require that an email field(ex. subject) to be populated before being able to send?

We are in the process of designing a custom form for a business and were curious if there was a way to require that a field be populated before being able to send.  We want to force a number to be input.  Is this possible?
ASKER CERTIFIED SOLUTION
Avatar of omgang
omgang
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Infinity Solutions

ASKER

Works great thank you.  Would you happen to know if you can make this field unchangeable after the first initial email?
Are you asking for replies and forwards?  I don't think so.  Or am I mis-understanding you?
OM Gang
Pretty much.  I have it set to read only at the moment in the read page settings but as soon as you hit reply the field is editable and the value resets to default for the form.
In general, any email message you reply to or forward is fully editable by you.  There is no method that I know of for the original drafter/sender to 'lock' the content of an email message.
Consider that even if you converted all content on your custom Outlook form to an image file (.bmp, .jpg, etc.) and embedded that image within an email message prior to sending, the recipient could still reply to/forward the message and delete the image.  The image solution may provide the desired effect of preventing the recipient from manipulating the form fields (because they're actually just a part of an image) if they reply/forward.  To do this will require some coding, however, but I think it may be doable.

OM Gang
Was going to see if i could ask one more thing if you happen you see this.  Is there a specific validation formula to require a job number but could also allow normal letters?  We want them to be able to fill the subject field normally, but not allow the email to be sent unless a job number is also added.
Try this for the job number validation; it requires data entry into the field, i.e. field cannot be empty.
\[JobNumber\] "" 
Note that by using the validation formula you can also create a custom error message to the user in the "Display this message if the validation fails" box.

OM Gang
Having trouble implementing this.  There is a checkbox for requiring a value in the field though.  I was just particularly curious if there was such a statement for words as there is numeric values like the isnumeric(Subject)=true formula you showed us earlier.   And if there is I would like to combine the two with an 'and' statement or something similar if possible.  An alphanumeric requiring formula would also work.
got the no numeric statement to work but using NOT isnumeric.  Still would like to know if there is a way to do multiple validation formulas for one field.  For example:
       
 NOT isnumeric([Subject])=True AND isnumeric([Subject])=True

This does not work however.  It gives the error popup for validation that I have defined when entering just a number, just letters, and also with both(which is what we would like to validate the formula).
I've been playing around with Outlook forms a bit but I admit I'm no expert on them.  A field validation expression like
[Subject]>0 will require something to be entered into Subject field.
I'm not sure I understand your intent with
NOT isNumeric[Subject] AND isNumeric[Subject]
Basically, you want the user to have to enter something into the Subject field (or some other field).  The data can be numbers or text or both?  Is this correct?

OM Gang
Yes we would like them to be able to enter both text and numbers in the subject line, but require a number no matter what. This made it unable to use the isnumeric statement as text was not able to be input.
I had opened another thread more specifically to this issue and was given some code that ive been able to attach to a macro and get the form to act about how I would like.  Was hoping to not have to do that though if I could figure out if there is a legit validation formula that would work.

Here is my other post:
https://www.experts-exchange.com/questions/28854379/Is-it-possible-to-assign-2-validation-formulas-to-one-field-in-an-outlook-form.html
Crystal's solution is a good one.
Your goal is to require a number SOMEWHERE within the form field but to ALSO allow text.
I don't think that's possible with the validation expressions available in the Form designer.  As you know, we can use compound expressions joined with AND or OR operators but, unless I'm missing something, each expression operates on the entire form field contents; that's where the problem lies.  The VBA solution presented by Crystal iterates the length of the form field contents string testing for a numeric value.  This accomplishes the goal the validation expression could not.

OM Gang
It does seem to work well.  I just noticed though that this now runs on every email and not just the form I created.  Is there a different section to put the code for it to run only on my form?
I haven't ever tried but I'm thinking you'll want to modify the VBA code to check to see if it's running on the specified form first and do nothing if it's not, i.e. something like

If {FormName} = "MyCustomForm" Then
   'Proceed with validation
End If

I belive you'd actually check the MessageClass of the current item to determine form name.  Crystal may be able to answer that question better than I.  If not, post back here and I'll see if I can test for you.
OM Gang
Awesome thanks so much for the help so far, I will test and get back.