Is there any way to have contextual error messages with VLF-ONE?
xDemoWebContextualMessages shows how you can use contextual messages to show validation issues to the user. I would like to be able to do something similar.
VLF's avIssueMessage does not seem to nightlight or put some indicator on the control itself which is what I want. I tried using SYS_MSGQ but nothing seems to happen when a message is added.
My use case is that we have a "Notes" that consist of 5 separate fields (Line1 - Line5) in a File. I created a work field to use a Multi-Line edit box ( a simple control will not get hooked up into the PRIM_EVP collection) and then collapse those lines into a single value and set the work field to that value.
Since the work field is a free format text field, its length must be constrained by the sum of the lengths of the line fields. When the user puts in text that exceeds that length, I want to "highlight" that error in the same way that the above mentioned contextual errors do.
VLF-ONE Contextual Error Messages
Re: VLF-ONE Contextual Error Messages
Yous should be able to do this, and there may be several ways, but first a question ...........
Do you have an #AVFRAMEWORKMANAGER.avReceiveSystemMessageQueue method invocation in your code?
Do you have an #AVFRAMEWORKMANAGER.avReceiveSystemMessageQueue method invocation in your code?
Re: VLF-ONE Contextual Error Messages
I am assuming you want the message text to display in the status area of the command handler pane?
If yes, then attached is an updated version of reusable part DF_T42H1O, the shipped Business Object 101 example command handler.
If you import it to replace DF_T42H1O and recompile it then it should demonstrate what you want to do.
It now has a new method PerformLocalValidation that attempts some local validations before attempting to save on the server.
It shows how to get the red attention marks in a VLF command handler:
If yes, then attached is an updated version of reusable part DF_T42H1O, the shipped Business Object 101 example command handler.
If you import it to replace DF_T42H1O and recompile it then it should demonstrate what you want to do.
It now has a new method PerformLocalValidation that attempts some local validations before attempting to save on the server.
It shows how to get the red attention marks in a VLF command handler:
- Attachments
-
- QuickExport20170313163855.zip
- (15.06 KiB) Downloaded 1115 times
Re: VLF-ONE Contextual Error Messages
If you want to go for something much less subtle then try this version which highlights the error fields with a yellow fluro highlighter ........
- Attachments
-
- QuickExport20170313170607.zip
- (15.19 KiB) Downloaded 1147 times
Re: VLF-ONE Contextual Error Messages
Hi Mark,
Thanks for the samples.
I do have the avReceiveMessageQueue at the top of my SaveDataService.Completed event routine.
Should the messages work with MultLine Edit Boxes?
I added an Edit Control (#Edit1) along with my Notes work field (#wk_Notes, a multiline edit visual host) and a plain MultiLine Edit Box (#Text1). I add a message for all three of these and only the #Edit1 indicator shows up.
For some reason the indicators do not turn on for MultiLine EditBoxes.
Thanks for the samples.
I do have the avReceiveMessageQueue at the top of my SaveDataService.Completed event routine.
Should the messages work with MultLine Edit Boxes?
I added an Edit Control (#Edit1) along with my Notes work field (#wk_Notes, a multiline edit visual host) and a plain MultiLine Edit Box (#Text1). I add a message for all three of these and only the #Edit1 indicator shows up.
Code: Select all
mthroutine name(Save)
* define the data service
define_com class(#CMGCCPServerModule.SaveDetails) name(#save)
#SYS_MSGQ.Add( "Error 1" #Edit1 )
#SYS_MSGQ.Add( "Error 2" #wk_Notes )
#SYS_MSGQ.Add( "Error 3" #Text1 )
return
* other stuff omitted
endroutine
Re: VLF-ONE Contextual Error Messages
avReceiveMessageQueue routes all messages from #SYS_MSGQ into the message display area at the bottom of the command handler pane.
Then it clears #SYS_MSGQ, which is the critical operation with regard to the red error exclamation marks because because that removes them all from the display. That is is why the first example did not use avReceiveMessageQueue when generating local messages.
Then it clears #SYS_MSGQ, which is the critical operation with regard to the red error exclamation marks because because that removes them all from the display. That is is why the first example did not use avReceiveMessageQueue when generating local messages.
Re: VLF-ONE Contextual Error Messages
I don't think you can apply the red exclamation mark error indication to labels or to multi line edit boxes.
My suggestion would be to create a distinctive error style and use it like this example:
Ultimately, this is really just a variation of the second DF_T42H1O example provided.
BTW - this is a good case for creating a VLF-ONE custom framework manager because it would allow you to centrally define the error style.
My suggestion would be to create a distinctive error style and use it like this example:
Code: Select all
Begin_Com Role(*EXTENDS #PRIM_WEB)
Define_Com Class(#Prim_vs.SolidBrush) Name(#ErrorBackground) Color(255:233:157)
Define_Com Class(#Prim_vs.Style) Name(#ErrorStyle) Backgroundbrush(#ErrorBackground)
Define_Com Class(#xEmployeeSurname.Visual) Name(#UseSurname) Displayposition(1) Left(23) Parent(#COM_OWNER) Tabposition(1) Top(112)
Define_Com Class(#PRIM_LABL) Name(#TestLabel) Caption('Label1') Displayposition(2) Ellipses(Word) Height(25) Left(24) Parent(#COM_OWNER) Tabposition(2) Tabstop(False) Top(176) Verticalalignment(Center) Width(505)
Define_Com Class(#PRIM_TEXT) Name(#TestMultiLineText) Displayposition(3) Left(24) Parent(#COM_OWNER) Tabposition(3) Top(232) Width(569) Height(145)
Define_Com Class(#Prim_phbn) Name(#ApplyErrors) Caption('Apply Errors') Parent(#COM_OWNER) Displayposition(5) Tabposition(5) Width(215)
Define_Com Class(#Prim_phbn) Name(#RemoveErrors) Caption('Remove Errors') Parent(#COM_OWNER) Displayposition(4) Tabposition(4) Width(215) Left(256)
Define_Com Class(#Prim_vs.Style) Name(#SaveBasicVisualStyle) Reference(*DYNAMIC)
* -------------------------------------------------------------------------
Evtroutine Handling(#com_owner.CreateInstance)
#SaveBasicVisualStyle <= #UseSurname.Style
#UseSurname.Value := "Fred Bloggs"
Endroutine
* -------------------------------------------------------------------------
Evtroutine Handling(#ApplyErrors.click)
* Reset everyone to default styles
#UseSurname.editstyle <= #SaveBasicVisualStyle
#TestLabel.Styles.Remove Style(#ErrorStyle)
#TestMultiLineText.Styles.Remove Style(#ErrorStyle)
* Apply error styles as if everything is in error
#UseSurname.editstyle <= #ErrorStyle
#TestLabel.Styles.add Style(#ErrorStyle)
#TestMultiLineText.Styles.add Style(#ErrorStyle)
Endroutine
* -------------------------------------------------------------------------
Evtroutine Handling(#RemoveErrors.click)
* Reset everyone to default styles
#UseSurname.editstyle <= #SaveBasicVisualStyle
#TestLabel.Styles.Remove Style(#ErrorStyle)
#TestMultiLineText.Styles.Remove Style(#ErrorStyle)
Endroutine
End_Com BTW - this is a good case for creating a VLF-ONE custom framework manager because it would allow you to centrally define the error style.
Re: VLF-ONE Contextual Error Messages
I wonder if MarkD's statement about the limitations of the red exclamation mark error indicator also applies to DropDownLists?
I was unable to get the exclamation mark to appear for my Status Field (DropDownList) using #SYS_MSGQ.Add( 'Status must be entered' #OC01_Status ).
I had to apply an error style instead.
I was unable to get the exclamation mark to appear for my Status Field (DropDownList) using #SYS_MSGQ.Add( 'Status must be entered' #OC01_Status ).
I had to apply an error style instead.