![]() | ![]() |
|
10-13-2010 11:38 AM
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
10-13-2010 06:06 PM
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.
10-14-2010 09:05 AM
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.
10-14-2010 07:23 PM
I'm game.
Can anyone start me off with an example?
Ken
10-14-2010 11:44 PM
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?
10-14-2010 11:46 PM
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.
10-15-2010 10:03 AM
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.
10-15-2010 07:33 PM
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.
10-18-2010 10:32 AM
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
10-19-2010 12:19 PM
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:-)
![]() |
![]() |
![]() |
|
|
![]() |
![]() |
![]() |
















