1212if ($ field ->required ) {
1313 $ attrs [] = 'required ' ;
1414 if (!empty (trim ($ field ->custom_error ))) {
15- $ attrs [] = 'data-parsley-required-message=" ' . JText::sprintf ($ field ->custom_error ) . '" ' ;
15+ $ attrs [] = 'data-parsley-required-message=" ' . JText::sprintf ($ field ->custom_error ) . '" ' ;
1616 } else {
17- $ attrs [] = 'data-parsley-required-message=" ' . JText::sprintf ('MOD_JDSCF_REQUIRED_ERROR ' , strip_tags ($ label )) . '" ' ;
17+ $ attrs [] = 'data-parsley-required-message=" ' . JText::sprintf ('MOD_JDSCF_REQUIRED_ERROR ' , strip_tags ($ label )) . '" ' ;
1818 }
19- }
19+ }
2020$ attrs [] = 'id=" ' . $ field ->name . '-file-input" ' ;
2121//fetching allowed types
2222$ params = JComponentHelper::getParams ('com_media ' );
3131?>
3232<div class="custom-file">
3333 <input id="<?php echo $ field ->name ; ?> -<?php echo $ module ->id ; ?> " accept="<?php foreach ($ allowable as $ type ) { echo ". " .$ type .", " ; } ?> " type="file" name="jdscf[<?php echo $ field ->name ; ?> ]" class="custom-file-input" <?php echo implode (' ' , $ attrs ); ?> >
34- <label class="custom-file-label" for="<?php echo $ field ->name ; ?> -file-input "><?php echo JText::_ ('MOD_JDSCF_FILE_BTN_LBL ' ); ?> </label>
34+ <label class="custom-file-label" for="<?php echo $ field ->name ; ?> -<?php echo $ module -> id ; ?> "><?php echo JText::_ ('MOD_JDSCF_FILE_BTN_LBL ' ); ?> </label>
3535</div>
3636
3737<div class="filesize-err filesize-error-<?php echo $ field ->name ; ?> -<?php echo $ module ->id ; ?> alert alert-danger alert-dismissable">
5555 $ js .= '} ' ;
5656$ js .= '}; ' ;
5757
58+
59+ // $js .= "jQuery('#" . $field->name . '-' .$module->id . "').on('change', function() {";
60+ // $js .= "var fileName = jQuery(this).val().split('\\').pop();";
61+ // $js .= "jQuery(this).siblings('.custom-file-label').addClass('selected').html(fileName);";
62+ // $js .= "});";
63+
64+ $ js .= 'jQuery("# ' . $ field ->name . '- ' .$ module ->id . '").on("change", function() { ' ;
65+ $ js .= 'var fileName = jQuery(this).val().split(" \\\").pop(); ' ;
66+ $ js .= 'jQuery(this).siblings(".custom-file-label").addClass("selected").html(fileName); ' ;
67+ $ js .= '}); ' ;
68+
5869ModJDSimpleContactFormHelper::addJS ($ js , $ module ->id );
5970?>
0 commit comments