Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > Check for invalid characters in description

Forum

Search UsersRules
Check for invalid characters in description
#1
Active user
Points:: 0
Joined:: Sep 27, 2011

I'm trying to check for invalid characters in description fo Goods catalog, here is the Item form module Script:

Code
Var AllowedCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 -/()";

&AtClient
Procedure DescriptionOnChange(Item)
   Length = StrLen(Object.Description);
   For I = 1 To Length Do
      Char = Mid(Object.Description, I);
      If Not Find(AllowedCharacters, Char) Then
         DoMessageBox(NStr("en = 'Invalid characters in description'"));
         Break;
      EndIf;
   EndDo;
EndProcedure


But it produces following errors:

{Catalog.Goods.Form.ItemForm.Form(1,22)}: Expecting ';'
Var AllowedCharacters<<?>> = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567­890 -/()"; (Verification: Server)
{Catalog.Goods.Form.ItemForm.Form(1,23)}: Unknown operator
Var AllowedCharacters <<?>>= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567­890 -/()"; (Verification: Server)
{Catalog.Goods.Form.ItemForm.Form(1,22)}: Expecting ';'
Var AllowedCharacters<<?>> = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567­890 -/()"; (Verification: Thin client)
{Catalog.Goods.Form.ItemForm.Form(1,23)}: Unknown operator
Var AllowedCharacters <<?>>= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567­890 -/()"; (Verification: Thin client)

Profile
#2
Just came
Points:: 7
Joined:: Mar 15, 2012

1c is not support assignment of value in description of variable.

You should to do this in module or in procedure.

Code
Var AllowedCharacters;

&AtClient
Procedure DescriptionOnChange(Item)
    AllowedCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW­XYZ1234567890 -/()";
    Length = StrLen(Object.Description);
    For I = 1 To Length Do
        Char = Mid(Object.Description, I);
        If Not Find(AllowedCharacters, Char) Then
            DoMessageBox(NStr("en = 'Invalid characters in description'"));
            Break;
        EndIf;
    EndDo;
EndProcedure


OR

Code
Var AllowedCharacters;

&AtClient
Procedure DescriptionOnChange(Item)
    Length = StrLen(Object.Description);
    For I = 1 To Length Do
        Char = Mid(Object.Description, I);
        If Not Find(AllowedCharacters, Char) Then
            DoMessageBox(NStr("en = 'Invalid characters in description'"));
            Break;
        EndIf;
    EndDo;
EndProcedure 

AllowedCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW­XYZ1234567890 -/()";

Profile
#3
Active user
Points:: 0
Joined:: Sep 27, 2011

Thank you very much! Now it works!

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.