Re: Odd Requirement

2017-10-06 Thread Bas Gooren
Hi,

Sounds like you need a decorator for all of your validators, which runs the
wrapped validator (or not) based on a flag.

This is a possible implementation:

E.g.

enum ValidationMode {
Format, Full
}

class ModeDependantValidatorDecorator implements IValidator {
IValidator wrapped;
IModel modeModel;
ValidationMode desiredMode;

… ctor …

void validate(IValidatable validatable) {
if(modeModel.getValue() == desiredMode) {
wrapped.validate(validatable);
}
}
}

You’ll need to wrap all validators that you want to toggle on/off with this
decorator.
Put the ValidationMode model in your page, and let the submitting
components set it based on their desired validation mode.
Detach the model on page detach.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 5 oktober 2017 bij 20:34:35, Entropy (blmulholl...@gmail.com) schreef:

We have an odd requirement that I was wondering how to implement in wicket.
we're in Wicket 6. The analysis team wants the ability to save a page in an
incomplete fashion. Only format validations fire (you can enter nothing,
but if you enter anything, you must at least comply with format rules...no
entering letters in a date field) on some save events, but when you hit a
Continue we validate the whole enchilada.

But they also want this exit button that is particularly throwing us for a
loop because they want to prompt, asking the user if they want to save
first, and if yes, we save with just format validators, and either way
invalidate the session.

Setting default form processing isn't quite right for us because it turns
ALL of the validators on or off, and AFAIK, can't be set after the event is
already underway.

-- 
Sent from:
http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Odd Requirement

2017-10-05 Thread Entropy
We have an odd requirement that I was wondering how to implement in wicket. 
we're in Wicket 6.  The analysis team wants the ability to save a page in an
incomplete fashion.  Only format validations fire (you can enter nothing,
but if you enter anything, you must at least comply with format rules...no
entering letters in a date field) on some save events, but when you hit a
Continue we validate the whole enchilada.  

But they also want this exit button that is particularly throwing us for a
loop because they want to prompt, asking the user if they want to save
first, and if yes, we save with just format validators, and either way
invalidate the session.

Setting default form processing isn't quite right for us because it turns
ALL of the validators on or off, and AFAIK, can't be set after the event is
already underway.  

--
Sent from: http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org