How to make a custom error message for form field?

Understanding basics of 1C:Enterprise platform. To start working with 1C:Enterprise platform visit Getting started page

#1
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Jul 18, 2012
Company:

Good morning!

I've found error messages which display near the form field if the corresponding attribute is marked as required. But it works for filling only and what if I would like to check this attribute to be a valid string? For example I can check an e-mail to be of xx@xx.xx format.

How can I output a custom error message in the way as it is on the attached picture?

Download 001.png (9.82 KB)
 
#2
People who like this:1Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

Hi, Lies, you need to use UserMessage object. Here is an example from Syntax Assistant:

Code
&AtClient
Procedure ActionWithObject(DataObject)
    ...
    Message = New UserMessage();
    Message.Text = "In line 11 of tabular section ""Item"""
             +MissingCount+" "+ItemsUnit + " is missing.";
    Message.Field = "Items[10].Count";
    Message.SetData(DataObject);
    Message.Message();

EndProcedure

 
#3
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Jul 18, 2012
Company:

Thanks, Timofey!

 
#4
People who like this:1Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

You're very welcome, Lies.
See ShowErrorMessage procedure in StandardSubsystemsClient module of 1C:Subsystems Library usage for additional example.

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.