Dynamic form Wbraganca basic question

Hi, I’m testing the basic example of wbraganca’s Dynamic form, however there seems to be something wrong in my code,

In the controller in create action, when I put

$Valid = Model::validateMultiple ($modelsAddress) && $valid;

It gives me a validation error and is because $modelAddress->customer_id has no value, and makes sense because it is only up to a few lines after I assign it the value.

Can someone help me please?

The author of the extension describes how to use it with a detailed sample code.

Are you trying to test the sample code as it is? Then it might be a simple typo.

For example, ‘$Valid’ and ‘$valid’ are different things.

Hello thank you very much. I used the sample code. In the next link you can see the same issue:

However, delete required rule for $custumer->id is bad idea for the ingrity of database.

I see.

No, I don’t think so. Since the end user won’t touch customer_id attribute in the form at all, and you will always set it in the controller, you don’t have to validate it. The validation is for user input.