How Can I cause Express to Validate Fields When I Click SAVE
How Can I cause Express to Validate Fields When I Click SAVE
Hello Roger
I have a SAVE button in my main Dialog. If I open a dialog (MDI) and enter some GETs, I want all the VALID clauses of my GETs to be executed, before a successful save. Similar to EXITVALIDATE clause of DCGETOPTIONS, but my dialog is not closed.
Thanks.
Joseph.
I have a SAVE button in my main Dialog. If I open a dialog (MDI) and enter some GETs, I want all the VALID clauses of my GETs to be executed, before a successful save. Similar to EXITVALIDATE clause of DCGETOPTIONS, but my dialog is not closed.
Thanks.
Joseph.
-
- Posts: 605
- Joined: Thu Jan 28, 2010 9:11 pm
- Location: Steven Point, Wisconsin USA
- Contact:
Re: How Can I cause Express to Validate Fields When I Click
I put the items I want to have validated, usually only a subset of the valids on the gets, in a CheckValid(aApp,aMainGetlist) function call. This validates the array of codeblocks I put here and if it fails, it returns focus to the get object specified.
The call is in my save button codeblock. I like it better as it gives me the control I need. No every valid needs to be revalidated. Some of the field level valid items are sufficient themselves and do not need to be validated when the save button is called.
Cliff.
The call is in my save button codeblock. I like it better as it gives me the control I need. No every valid needs to be revalidated. Some of the field level valid items are sufficient themselves and do not need to be validated when the save button is called.
Cliff.
Re: How Can I cause Express to Validate Fields When I Click
Traverse the getlist array, evaluate the VALID clauses if there are some:
Code: Select all
FUNCTION ValidateAll(aGetList)
LOCAL i, bValidBlock, lWhatToDo
FOR i := 1 to Len(aGetList)
bValidBlock := aGetList[i,bGETLIST_VALID]
lWhatToDo := Eval(bValidBlock) // evaluate VALIDs
* do something - or nothing
NEXT
...
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: How Can I cause Express to Validate Fields When I Click
You could also use the function DC_GetListValidate( GetList ).
The eXpress train is coming - and it has more cars.
Re: How Can I cause Express to Validate Fields When I Click
This is fine but if I have a GET with HILDE {. T.} And I also have a VALID validates it.
It is possible to exclude GET HILDE {. T.}
thanks
Miguel
It is possible to exclude GET HILDE {. T.}

thanks
Miguel
Re: How Can I cause Express to Validate Fields When I Click
I don't understand why you would have a valid clause on an object that is always hidden.
The eXpress train is coming - and it has more cars.
Re: How Can I cause Express to Validate Fields When I Click
Sorry I have not expressed well. I mean I have certain GETS that may or may not depending on a condition HILDE for example:
HIDE {| | nControl> 2}
Thanks for your reply and greetings
Miguel
HIDE {| | nControl> 2}
Thanks for your reply and greetings
Miguel
Re: How Can I cause Express to Validate Fields When I Click
Sorry, DC_GetValidate() has always ignored Gets that are not visible.
I will probably not change that behavior now because it will break other applications.
You can use Tom Liehr's suggestion or you can modify the DC_GetValidate() code in _DCGETBX.PRG.
I will probably not change that behavior now because it will break other applications.
You can use Tom Liehr's suggestion or you can modify the DC_GetValidate() code in _DCGETBX.PRG.
The eXpress train is coming - and it has more cars.
Re: How Can I cause Express to Validate Fields When I Click
Roger seems that we still do not understand so I'll start again with the question.
My problem is that when I run "DC_GetListValidate (GetList)" I is validating all including hidden GETS HIDE {| | nControl> 2} and do not want to happen.
I confirm that I GETS only assets and not hidden.
Regards
Miguel
My problem is that when I run "DC_GetListValidate (GetList)" I is validating all including hidden GETS HIDE {| | nControl> 2} and do not want to happen.
I confirm that I GETS only assets and not hidden.
Regards
Miguel
Re: How Can I cause Express to Validate Fields When I Click
Using Toms code as a starting point, you can use the getlist pointer bGETLIST_HIDE to return the HIDE codeblock. If that codeblock evals as TRUE then don't eval the VALID codeblock for that item.MIGUELON wrote:Roger seems that we still do not understand so I'll start again with the question.
My problem is that when I run "DC_GetListValidate (GetList)" I is validating all including hidden GETS HIDE {| | nControl> 2} and do not want to happen.
I confirm that I GETS only assets and not hidden.
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com
Real Business Applications Ltd
http://www.rbauk.com