Yii Framework Forum: how to set an image as label for submitButton - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

how to set an image as label for submitButton Rate Topic: -----

#1 User is offline   murugan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 72
  • Joined: 12-June 09
  • Location:Chennai,India

Posted 28 June 2009 - 06:03 AM

i want to give uparrow ,downarrow as label to submitbuttons,
so how to give a image to submitbutton
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,895
  • Joined: 04-October 08
  • Location:DC, USA

Posted 28 June 2009 - 07:57 AM

This is a css question. Set a background image for the button.
0

#3 User is offline   resplendent 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 60
  • Joined: 22-May 09
  • Location:Singapore

Posted 29 June 2009 - 02:29 AM

hi there,

you might want to try CHtml::imageButton();
0

#4 User is offline   murugan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 72
  • Joined: 12-June 09
  • Location:Chennai,India

Posted 30 June 2009 - 05:06 AM

Thanks resplendent
0

#5 User is offline   kk 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 01-July 09

Posted 03 July 2009 - 06:39 AM

i want to insert image for the application that i am building

i used
image() method
public static string image(string $src, string $alt='', array $htmlOptions=array ( ))

i want to know does
$src = path to image file??? ex: D:\image\image.bmp


i put the path but it is not showing the mage
only the alternative text is displayed......
0

#6 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,895
  • Joined: 04-October 08
  • Location:DC, USA

Posted 03 July 2009 - 10:03 AM

$src should be a URL, not a file system path.
0

#7 User is offline   Deepak Pradhan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 209
  • Joined: 01-May 09
  • Location:Charlotte, NC

Posted 05 July 2009 - 11:33 PM

here is a smaple CSS for your form.css

input[type='submit'] {
    background: #009EEA url('http://c2eat.com/images/i22/submit.png') no-repeat left;
    border-color: #aaa #000 #000 #aaa;
    border:1px solid;
    color:#FFFFFF;
    display:block;
    text-align:left;
    height:26px;
    width:100px;
    padding-left:24px;
    left:1px;
    position:relative;
    top:1px; }

    input[type='submit']:hover {
        border-color: #000 #aaa #aaa #000;
        left:1px;
        position:relative;
        top:1px; }

0

#8 User is offline   sirin k 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 35
  • Joined: 15-March 12
  • Location:India

Posted 07 September 2012 - 08:53 AM

i got this working:

<style>
 .button1 {
  background:url('<?php echo Yii::app()->request->baseUrl."/images/btn-deliver-gift.jpg"; ?>');
  width:244px;
  height:56px;
  cursor:pointer;
  border-radius: 12px;
  }

</style>
        <div class="form-row">    
	     <?php echo CHtml::submitButton('',array('class'=>'button1')); ?>
	</div>

Sirin k
Yii developer
http://sirink.tumblr.com
1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users