Closed mondomeme closed 4 years ago
Well every widget uses its own HTML and can include different implementations of the HTML structure which isnt covered in it , you might have to add your own implementation for the $.formwizard.preview.getLabel()
which should work with the widget to display label, otherwise it will show undefined
as it expects by default that the label will be the sibling of the input, the file count is added via abad988
@buttflattery I'm sorry if I respond only now, but I tried to override the function in the view in which I render the form wizard, adding this code :
$this->registerJs(<<<JS $.formwizard.preview.getLabel = function(fieldName){ let text = $('#' + fieldName).siblings('label').text(); console.log(text); //only for test purpose if (text !== '') { return text; } return $('#' + fieldName).attr("placeholder"); } JS );
.
When I load the page I have the following error: $.formwizard.preview is undefined
@mondomeme you should try loading the scrip on the DOM READY using the \yii\web\View::POS_READY
as the second parameter of the $this->registerScript()
@buttflattery I tried to use the POS_READY
as second parameter of $this->registerJs()
, but I have the error TypeError $.formwizard.preview is undefined
Well what you are doing wrong is may be my mistake too somehow as i linked the code with the title $formwizard.preview.getLabel
whereas it is actually $.formwizard.previewStep.getLabel
:/ sorry for that i just realized that after doing some audit @mondomeme
@buttflattery ok, now it works perfectly. Thank you
your are welcome @mondomeme
I'm to use kartik file input widget for uploading multiple files. I successfully load and save the the files, but in the preview step I would like to see a the number of files loaded instead of upload model fields. Thank you.