Issue with readOnlyEditFields when one of the fields is required

Hi,

I noticed an issue with readOnlyEditFields. If you have a readOnlyEditFields set on a field and that field is also required, when you try to save the edit the required validation complains the field is not populated even though it is.

Thanks

Just to note this is on a setRelational field.

Anyone got any way around this?

Thanks

Hi,
I had the same problem migrating from orig GC to the new GC Ent

what I did, with the help of @johnny is this:

(readOnlyEditField ā†’ field3)

if($crud->getState()==ā€˜EditFormā€™ || $crud->getState()==ā€˜Updateā€™){
$crud->requiredFields([ā€˜field1ā€™,ā€˜field2ā€™]);
}else{
$crud->requiredFields([ā€˜field1ā€™,ā€˜field2ā€™,ā€˜field3ā€™]);
}

1 Like

Brilliant thanks for the detail I will try this!

1 Like

Is there a enterprise bug tracker and somewhere I can submit bugs?

Unfortunately there isnā€™t. Currently the way that I am dealing with bug fixes is pick them up from forums/emails and add them to a huge private backlog that I have.

For example for this particular issue that you have unfortunately I canā€™t consider it as a bug because of the nature of Grocery CRUD Enterprise fields that can have only one field type per field. For example you ā€œcanā€™tā€ have both a field required and readOnly. The same thing happens (a very common issue) when you have a setRelation field and you would like to use it with callbackColumn (a callback field is still a different field type)

This is a big confusion for anyone but something to keep a note for the next major version of Grocery CRUD (e.g. version 3).

Ok noted,

If there is no list anywhere I will just continue to ask questions if I think maybe it is a bug.

@johnny - Perhaps there is no change with V3 as well.
At the time of add we need it as required field while on edit it should be readonly. Please suggest how to achieve it?