rapyd-laravel icon indicating copy to clipboard operation
rapyd-laravel copied to clipboard

Form passed problem

Open IProSoft opened this issue 9 years ago • 3 comments

Hi I cant find info how to validate/upload all form fields created with \DataForm::create() Ex function attached to image is never called with passed function:

$form = \DataForm::create()
$form->add( $key, 'Image', 'image' )->moveDeferred('uploads/tmp/{{$id}}')->image( function ($image){
    /* not called */
} );

$form->passed( function( $form ) use ($quiz){
    /* what to call to handle input file and others*/
})

Also how to set value to image input so it can be deleted or changed ?

IProSoft avatar Oct 21 '15 19:10 IProSoft

Answer for my first question: you can't use moveDeferred with \DataForm::create()

IProSoft avatar Oct 22 '15 18:10 IProSoft

roger, for the second question the problem is here https://github.com/zofe/rapyd-laravel/blob/master/src/DataForm/DataForm.php#L497 I'll fix

zofe avatar Oct 22 '15 19:10 zofe

For second question thing is tricky: You can't just use delete checbox like in edit form because it can't find image. It had to be done in $form->passed function by checking if hidden input was send with delete request. Hidden input must be added as form field with name/path of image.

IProSoft avatar Oct 24 '15 13:10 IProSoft