NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Koen Tjoa on November 16, 2011, 01:58:56 PM
-
Hi All,
In a button on a NetWebForm I do some checking. If an error occurs, I would the message to appear just below the sub heading. So set loc:Alert = 'Oops, this is not good'. The code is in the Validate::MyButton Routine. When the error occurs loc:Alert is set, followed by a call the SendAlert routine and then an exit from the routine is done preventing the rest the code to process.
This all is working fine except that loc:Alert isn’t reset if the user click another button, selects a record, etc. I guess I can clear and the call the SendAlert routine in the Validate::OtherControl Routine of all other controls, but there might be a better solution.
My code is:
Validate::MyButton Routine
IF p_web.GSV('Oops') = 1
!loc:invalid = 'MyButton' Seems to make no difference
!MyButton = true
loc:Alert = 'Oops, this is not good'
DO SendAlert
EXIT
END
! End of "Validate New Value"
If p_web.RequestAjax = 1 and p_web.ifExistsValue('NewValue')
ElsIf p_web.IfExistsValue('Value') !FormFieldPicture = !FieldPicture =
End
do ValidateValue::MyButton ! copies value to session value if valid.
do Value::TabArg !1
do Value::TabArgT !1
Cheers,
Koen
-
Koen,
Hi there.
I'm not sure if you left this out or not, but when you are setting things invalid, as well as loc:invalid, the next line you need:
MyButton:IsInvalid = true
Rather than "MyButton = true".
-
the two lines you commented out are important.
cheers
Bruce
-
Hi Stu and Bruce,
I tried but it adding those two lines. But they seem to make no difference in case the control is a button like it would be on a (numeric) field. Although loc:invalid and loc:Alert are cleared when another button or a new record in the browse control is selected, the message line just below the sub heading isn’t. That is what I would like to happen.
So I added DO SendAlert in the Validate::XXX routines of these controls. I guess this the way it should be done after all.
Cheers,
Koen