spacer
cornerspacercorner
Reply
Occasional Contributor
Targray
Posts: 4
Registered: 05-20-2010
0 Kudos

Checking field interrelationships

Version 7.5 Designer:

 

What are best practicies in terms of checking logical relationships between fields, issuing error messages to the user and preventing a process from advancing?

 

For example, I have 2 fields: Start Date and End Date. I need to ensure that a) the start date is less than the end date and b) if there is less than x days between the 2 dates, issue an error message and do not let the process advance to the next stage.

 

I know I can manage the above example by changing the date range on either field as the user changes the other, but I'm looking for a more generic response and example.

 

Thanks in advance!

 

Ken

Esteemed Contributor
Jerome҉
Posts: 744
Registered: 05-18-2010
0 Kudos

Re: Checking field interrelationships

Typically this involves a lot of code. In version 9 client scripts seem like coding wearing a blindfold (it is not any worse than v7, but the 'real' script edditor and syntax checker for C# makes it seem so much worse!).

 

We've had customers doing full validation on client side and on server side. I have never seen a solution I would call remotely generic, and we specialise in creating generic and easy to reuse Metastorm BPM snippets.

Frequent Advisor
Carolyn
Posts: 65
Registered: 06-30-2010
0 Kudos

Re: Checking field interrelationships

I disagree a bit, actually doing client-side javascript is really easy to debug once your process is running, so it's not like working blind at all. might be slightly more difficult to write, but a whole lot easier to test/change/debug. I love it, makes my life a lot easier.

 

You can put a client-side script on the form submission, return false so that the form doesn't submit if the values aren't what you want, you can put your error message to display to the client in the javascript function. It's actually fairly simple.

Occasional Contributor
Targray
Posts: 4
Registered: 05-20-2010
0 Kudos

Re: Checking field interrelationships

I'm game.

 

Can anyone start me off with an example?

 

Ken

Esteemed Contributor
Jerome҉
Posts: 744
Registered: 05-18-2010
0 Kudos

Re: Checking field interrelationships

 


Carolyn wrote:

I disagree a bit, actually doing client-side javascript is really easy to debug once your process is running, so it's not like working blind at all. might be slightly more difficult to write, but a whole lot easier to test/change/debug. I love it, makes my life a lot easier.

 

You can put a client-side script on the form submission, return false so that the form doesn't submit if the values aren't what you want, you can put your error message to display to the client in the javascript function. It's actually fairly simple.


How do you debug client scripts then?

 

Esteemed Contributor
Jerome҉
Posts: 744
Registered: 05-18-2010
0 Kudos

Re: Checking field interrelationships

I cannot give an example as it is nor something we have done in our own modules (since it cannot be made generic). The work we have done in this area for clients is not ours too share, unfortunately.

Frequent Advisor
Carolyn
Posts: 65
Registered: 06-30-2010
0 Kudos

Re: Checking field interrelationships

Attached example of client-side date comparison and friendly error messages on the form-submit script.

 

To get into the code, you do the following:

(a) Just before the code you want to debug, put a line into throw a delliberate error, like

            throw("break here");

(b) set internet explorer up to throw every error and not to disable script debugging

(c) run the procedure on a pc which has visual stufio installed

(d) when the error is thrown, choose to debug.

(e) when the script appears, right-click the line BELOW the error and select 'Set next statement'. Then you can step through code, view variables, etc.

 

Not blind...

 

If you have any generic script that you want to re-use, you can put it in a library.

 

 

Esteemed Contributor
Jerome҉
Posts: 744
Registered: 05-18-2010
0 Kudos

Re: Checking field interrelationships

OK, thanks for the explanation, it will help a lot.

 

I will (like a great many of us) leave that to those who have Visual Studio installed. It is still a great deal more cumbersome than the C# editor in v9 with colour coded sytax, syntax checking and intellisense. Writing client 'script' is still a bit like doing it blindfold, compared to writing server 'code'  IMO.

 

Now that the form refreshes are much faster (some are even unoticable) and the error message has finally ben made 'human readable' (although could use some work - whoever thought that was satisfactrory does not appreciate proper UI), I go for server side validations whenever I can.

Occasional Contributor
Targray
Posts: 4
Registered: 05-20-2010
0 Kudos

Re: Checking field interrelationships

Thank you Carolyn!

 

Can I impose upon you one more time? The file Demo.zip, appears to be V9 Designer. Are you able to create a V7.x compatible version for me?

 

Ken

Frequent Advisor
Carolyn
Posts: 65
Registered: 06-30-2010
0 Kudos

Re: Checking field interrelationships

you're very lucky, I was just about to switch my v7 off now that we're live on new version, but here it is. Is bit different in v because the date fields return text. Is much nicer in v9 - you should upgrade:-)

line spacer line
spacerFollow Metastorm on:
spacer Twitter YouTube Blog iTunes LinkedIn Metastorm Community Central, MC2
spacer Copyright © 2011 OpenText Corporation. All Rights Reserved.spacer About Metastormspacer Privacyspacer Legalspacer Site Mapspacer RSSspacer Contact Us
Microsoft Gold Certified Partner
Powered by Windows Azure
line spacer line