cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How To Validate a MetaAttributeValue

simikadampatta
Trusted Contributor

I have a Standard MetaAttribute 'Application URL'  of type String. I want to put a Validation Check on that MetaAttribute. The condition is that the user must not enter the space character in that field. It must be a continuous string without any spaces. Please help.
I thought of using the MetaAttributeUpdateTool but it is confusing.

Is there something similar out-of-the-box feature I can refer to? Or is there an alternate solution?

3 Replies

lionel
MEGA
MEGA

I'm not sure to understand your question... Now that you have the precise way to implement your macro, what is the problem to add a condition to the  AttCtl_Update function ? Can you be more precise about what is not clear for you ?

Can we modify this to also check if the same URL has been entered previously for the same application?

lionel
MEGA
MEGA

Hello,

I do not see any better ways then a metaAttributeUpdateTool.

Just code it the following way, and it should work :

 

'MegaContext(Fields,Types)
'Uses(Components)
Option Explicit

Function AttCtl_GetDefaultKind() As String 
End Function

Function AttCtl_Update(Context As MegaUpdateToolContext,Status As Integer,ErrorMessage As String) As Boolean
  Dim oRoot : oRoot = Context.GetRoot
  If Instr(Context.EditText, " ") > 0  Then
    ErrorMessage = "An URL must not contain space"
    Exit Function
  End If
End Function

 

Regards

 

Lionel