-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple file input #134
Comments
Are you sure this is the output your get for the text input? What happens if you change the name from |
Same issue.. Any solution. Can't show error class in input value. |
@sathishsanthoshsusidhar Could you provide a bit more information? There is nothing related to error classes in the original issue. Could you provide a piece of code that recreates the issue you're encountering? With what the actual output and what you expect. |
<?php foreach ($component->component_products as $key => $value) {
echo $this->Form->control('component_products.'.$key.'.id',['type' => 'hidden','label' => false]);
echo $this->Form->control('component_products.'.$key.'.product_id',['type'=> 'select','label' => false ,'empty' => 'Select','options' => $products]);
echo $this->Form->control('component_products.'.$key.'.number_of_component', ['type' => 'number', 'label' => false]);
echo $this->Form->control('component_products.'.$key.'.spare_count', ['type' => 'number', 'label' => false]);
echo $this->Form->control('component_products.'.$key.'.start_product_no', ['type' => 'number', 'label' => false]);
echo $this->Form->control('component_products.'.$key.'.end_product_no', ['type' => 'number', 'label' => false]);
} ?> I add table row dynamically its working fine in add edit. But it not show the error message when i left empty. Is working one to one relation. Not working in hasMany. How to solve it? Thanks in Advance. |
@sathishsanthoshsusidhar This has nothing to do with a Your pictures has time-related columns, but the code you show speak of number of components, etc., so it does not seem related. |
I believe there is a problem with bootstrap file input when using attribute "multiple".
In order to correctly upload multiple files i have to define my file input as array. For example:
<?= $this->Form->input( 'images[]', [ 'multiple' => true, 'type' => 'file'] ); ?>
This creates the file upload widget that includes a fake input for displaying number of files chosen:
<input type="text" name="images[]-text" class="form-control" readonly="readonly" id="images-input" onclick="document.getElementById('images').click();" value="">
Here is where the problem is:
When I dump the contents of
$_FILES
super global variable all the chosen files are there as expected. However, if I dump$this->request->data
one of the files is missing because the fake text input overrides it. What I propose is to replacereadonly
attribute on the fake input with adisabled
so that it doesn't get submitted (which proved to fix the issue for me).The text was updated successfully, but these errors were encountered: