I'm trying to figure out how I can change a single file uploader to a multiple file uploaded for one page and be able to handle the validation of those assets accordingly. With the following code below I am receiving this error. The only thing is its not so much a property as just the array that I need to loop over in my controller.
Getting unknown property: app\models\ModelName::REPORTS
https://www.yiiframework.com/doc/guide/2.0/en/input-file-upload
On this page I have changed my field to the following and need to figure out what to do for the rules.
<?php echo $form->field($model, 'REPORTS[]')->fileInput(['multiple' => true, 'class'=>'button'])->label('Report(s)'); ?>
[['REPORTS'], 'file'],
Related
I have the problem that my navbar.ctp element isnt loading i only get the error message from cakephp
Element file "Element/navbar.ctp" is missing.
My code in my default layout of cakephp (because i want the navbar in all "views")
<?php
echo $this->element('navbar');
?>
and my element is in Layout/Element/navbar.ctp
So i dont unterstand why it says me that my element is missing.
Do i have anything missing?
I hope someone could help me with the problem. I dont have much information, because its not complicated per se.
I think you have the file in the wrong folder.
Check the cookbook:
Elements live in the src/Template/Element/ folder, and have the .ctp
filename extension. They are output using the element method of the
view:
echo $this->element('helpbox');
Source: https://book.cakephp.org/3/en/views.html#elements
I have observed that when I execute the function:
Yii::$app->request->sendFile() within a row with a gridView, instead of launching the file, it shows it embedded in the HTML.
Then if I remove the Pjax::begin() and Pjax::end() borders that enclose the GridView, Then download works.
How can I work with both functionalities without losing one of them?
This was discussed at Yii2 the solution for now is to use this method:
<?php Pjax::begin([
'id' => 'list',
'linkSelector' => '#list a:not([data-pjax=0])'
]); ?>
custom js or simple link to your action with download
pjax link
<?php Pjax::end(); ?>
It looks like this feature may be included in future releases.
Is it possible to put js file after active form assets, when the file added via registerJsFile?
I have this code, but the file will be added after yii.js, but before yii.activeForm.js, and I can't find the right call at the moment:
$this->registerJsFile('#web/js/address.js', [
'depends' => [\yii\web\YiiAsset::className()]
]);
It is yii\widgets\ActiveFormAsset which you need to add the dependency to.
You need to add the dependency in the following way
$this->registerJsFile('js/buy-now.js', [
'depends' => [yii\widgets\ActiveFormAsset::className()],
]);
you can always check the source code for any specific widget class to see the name of the assets file that it is using inside the registerClientScript().
See ActiveForm
source
i'm a beginner and just learning about HTML. I just need a point in the right direction here. Any tutorials you can point me to would be greatly appreciated.
I am trying to create an offline version of this form I created on JotForm-http://form.jotform.us/form/40855701907154
I would like it to save the data a user inputs into an excel file.
I have tried saving the page offline by clicking 'save page as' but the 'submit' button doesn't appear.
I've been trying to understand this tutorial-http://diveintohtml5.info/offline.html.
Do I open the HTML file in notepad and try to edit it? If so, how do i edit it?
If you want to save the data to the Excel file.. you must store it first in database, then display your database in php with this header:
<?php
// excel raw data
header("Content-type: application/vnd-ms-excel");
// define the name "results.xls"
header("Content-Disposition: attachment; filename=results.xls");
// echo your database
include 'database.php';
?>
that is the simplest way for begginer... let me know if this work for you...
I have placed a codeigniter code and i want that code in html.Pls help me to do this.
<? echo anchor('login/signup', 'Create Account');?>
Not sure why you want that code (which generates an anchor when the HTML page is rendered - look at your browser page source)
But what that CI URL helper translates to is:
Create Account
I can only assume you maybe want to add attributes to it and don't know how?
For example, you could add an ID and/or class like so:
<? echo anchor('login/signup', 'Create Account', 'id="some-id" class="some-class"');?>
Just make sure you're loading that 'helper' in your controller, or set it to autoload in the config/autoload.php file (which makes the most sense for this type of helper, as it'll likely be used site wide).
For more info on the CI URL Helper, visit here:
http://ellislab.com/codeigniter%20/user-guide/helpers/url_helper.html