Skip to content

BelongsTo not respecting empty and rules parameters #84

Description

@rdlu

In my model I have this BelongsTo field, that I want to be compulsory:

        'destination' => new Sprig_Field_BelongsTo(array(
                                                        'model'=>'Entity',
                                                        'column'=>'destination_id',
                                                        'empty' => false,
                                                        'rules'=>array('isId'=>array()))),

But my rule is not called, and I can select " -- None", even with explicit empty=false

I have checked the input() from Sprig_Field_BelongsTo class with FirePHP, in all belongsTo fields the empty becomes true. I tried to track where in the sprig code the options are being overwritten, but no luck...

Another issue is that I need to explicit the column option, since its trying to get the 'model_id' instead 'field_id' in database query (in my case entity_id instead of destination_id).

I'm using master branch HEAD here.

Thanks for your spent time ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions