A Validation Issue On Current Yii

I’m not a proficient Yii programmer myself, not even a OOP guru.

So, and first of all, I must say, or repeat what many others have said:

"You can, perhaps, do almost everything in Yii, if you are able to extended and tweak it to your needs."

Again, I’m not Yii proficient, neither OOP guru, but I do believe, this last statement is true.

Despite this, however, I do understand that they should exist certain things that, for their common nature, shouldn’t not require such a need for tweaks.

Here’s our small history/experience:

On a ideal design prespective immo, here’s the points:

1 - CActiveForm usage on both, main _form and partials inside;

2 - Each member should be a partial;

3 - Each member should be loaded via ajax;

4 - Each member should be validated using their model rules() method;

  • so that we can benefit from (consistency server-and-client side, scenario usage, easier Yii::t() integration…)

5 - Working with either Ajax Validation or Client Side validation set to true;

While this may sound simple, truth is, achieving something like this is not possible at the moment.

Re-struture the "validation" classes in order to work on "nested" models scenarios, should be something that, as far as I can tell, would be a very important step to take on Yii 2.0;

Again. I’m not saying it’s not possible. But it’s clearly as well, not “out of the box” either.

K. Regards,

Mem

Hi,

I didn’t get where the problem is exactly. Sure, tabular input is a bit more complex than a simple form but that can not be changed.

Would be great if you could give more details about what you’d like to see in yii2 that helps with tabular input.

There are already very cool things that make it easy to work with tabular input:

I can’t really go into specifics.

But if we could:

  1. setup our models with the relations; (has many, belongs to etc…);

  2. instantiate on your actions (create() etc…) the models that should be used;

  3. setup a form with CActiveForm;

  • With clientSide validation enabled;
  1. setup our child partials views if needed; (without the need to use chtml on those and keep the same $form->error sintax inside those partials);

And once we load that form, CActiveForm could deal with the validations on those fields an also the (inner) validations of N child partials inside:

that would be nice.

Atm, this seems to be possible only with a LOT of extending work.

Does this makes sense to you?

I’m aware this implies design decisions on CActiveForm implementations on Yii side. But I can’t really tell what precisely.

I advocate in favor of such change, because I do believe, those are very common scenarios and, because of that, we should make what is common easier to achieve.

Either using CActiveForm alone, or the form builder, (or simplify this and just keep one of those), the 1-4 process below could be, perhaps, used.

Actually, "Tabular input", as a concept, seems strange atm.

Perhaps it shouldn’t be such a specific concept, and just be part of an “option” for a “multi model form” thing.

:)