Chaney
Chaney

Reputation: 465

Changing text beside upload field in Yii Framework

hopefully a quick question here, have not been able to find out the answer on google. Anyway I have the following File upload field.

    <div class="row">
    <?php echo CHtml::form('', 'post', array('enctype' => 'multipart/form-data')); ?>
    <?php echo $form->labelEx($model, 'doc'); ?>
    <?php echo CHtml::activeFileField($model, 'doc'); ?>
    <?php echo $form->error($model, 'doc'); ?>
</div>

The question I have is how to change the default text? On the page in question the upload field comes up with "No file chosen" beside the button when the page loads. I wish to change this text, anyone tell me how? Thanks.

Upvotes: 0

Views: 1647

Answers (1)

Nikos Tsirakis
Nikos Tsirakis

Reputation: 739

I quick & dirty fix is this:

<?php echo CHtml::activeFileField($model, 'type',array('style'=>'width:100px;', 'onchange' => 'this.style.width = "100%";')); ?>

Upvotes: 1

Related Questions