Use ajax to submit the set field value.

spotony - 7 months ago

I am using the pyrocms development store in the development user address. Each user can have one or more addresses. When using stream. Set the user id field to multiple-type type. Create ui is written independently. After the submission suggested that the wrong user_id not set the default value, ask how to use ajax address stream to set up the current user. request: region:贵州省, 贵阳市, 南明区 address:富源南路223号 address_alias:中国xxxx mobile:188xxxxxx location: posts_code:

'member'                        => [
            'type'      => 'anomaly.field_type.relationship',
            'config'    => [
                'mode'      => 'lookup',
                'related'   => Anomaly\UsersModule\User\UserModel::class,
            ],
        ],
/**
     *  The form fields.
     *
     *  @var        array|string
     */
    protected $fields = ['*'];

    /**
     *  The form model.
     *
     *  @var        string
     */
    protected $model = AddressModel::class;

ryanthompson - 7 months ago

Sorry I am not entirely sure what you as asking. But sounds like you might need to send model class / ID to an ajax controller and do like

$entry = Model::find($id);

Then set your data for the user using $entry = Model::find($id); perhaps?

spotony - 7 months ago

SQLSTATE[HY000]: General error: 1364 Field 'member_id' doesn't have a default value (SQL: insert into `lics_users_address` (`created_at`, `created_by`, `sort_order`) values (2017-02-15 11:49:14, 1, 1))

post data: member:1 region:贵xxxxx address:二xxxx电商产业聚集区A1区108-111 address_alias:xxxx旗舰店 mobile:18xxxxxx43 location:10x.xx,2x.51x0 posts_code:

ryanthompson - 7 months ago

Looks like you just need to provide a member ID or member object for the relation.

spotony - 7 months ago

In the input form does not submit the value of the field, how to use FromBuilder to set the value of the field