How Can I cause Express to Validate Fields When I Click SAVE

This forum is for eXpress++ general support.
Message
Author
User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

How Can I cause Express to Validate Fields When I Click SAVE

#1 Post by unixkd »

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.

Cliff Wiernik
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

#2 Post by Cliff Wiernik »

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.

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: How Can I cause Express to Validate Fields When I Click

#3 Post by Tom »

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."

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: How Can I cause Express to Validate Fields When I Click

#4 Post by rdonnay »

You could also use the function DC_GetListValidate( GetList ).
The eXpress train is coming - and it has more cars.

MIGUELON
Posts: 135
Joined: Wed Feb 10, 2010 10:55 am

Re: How Can I cause Express to Validate Fields When I Click

#5 Post by MIGUELON »

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

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: How Can I cause Express to Validate Fields When I Click

#6 Post by rdonnay »

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.

MIGUELON
Posts: 135
Joined: Wed Feb 10, 2010 10:55 am

Re: How Can I cause Express to Validate Fields When I Click

#7 Post by MIGUELON »

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

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: How Can I cause Express to Validate Fields When I Click

#8 Post by rdonnay »

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.
The eXpress train is coming - and it has more cars.

MIGUELON
Posts: 135
Joined: Wed Feb 10, 2010 10:55 am

Re: How Can I cause Express to Validate Fields When I Click

#9 Post by MIGUELON »

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

reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: How Can I cause Express to Validate Fields When I Click

#10 Post by reganc »

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.
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.
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

Post Reply