josebailo
josebailo

Reputation: 138

How to avoid losing the virtual fields after failing validation?

I have a model with two virtual fields full_name and avatar, avatar is the full path to the user avatar.

In the edit form I print the avatar picture but when I send the form and validation fails the virtual fields are lost because the model is not loaded and uses the $this->request->data information.

Is there any way to load the virtual fields without sending it in hidden fields?

Upvotes: 0

Views: 155

Answers (1)

ADmad
ADmad

Reputation: 8100

Have the virtual fields as hidden fields in the form.

Upvotes: 3

Related Questions