I am trying to make update password functionality, but at the moment when I use active record to create form, password field is populated with user password. How can I omit this? This is the code used for generating password field (rest of the form is standard active form template):
<?php echo $form->field($model, 'password')->passwordInput() ?>
Try this..
<?php echo $form->field($model, 'password')->passwordInput(['value'=>'']) ?>
Related
I am using the code below display multiple selected values for users to choose from.
<div class="row">
<?php echo $form->labelEx($model,'site_staff'); ?>
<?php //echo $form->textField($model,'site_staff',array('size'=>60,'maxlength'=>255)); ?>
<?php //echo $form->dropDownList($model,'site_staff', CHtml::listData(Biodata::model()->findAll(), 'full_name', 'full_name'), array('empty'=>'Select')); ?>
<?php echo $form->dropDownList($model,'site_staff',CHtml::listData(Biodata::model()->findAll(),'full_name','full_name'),array('multiple'=>'true','prompt'=>'select ','selected'=>'selected'));?>
<?php echo $form->error($model,'site_staff'); ?>
</div>
I am trying to achieve the following but have no idea how to go about:
1) Add and remove function
- When a user choose one or more, by clicking "Add", will display the selected value in another dropdown list
- User can also remove any selected data in the latter dropdown list
So far, the single dropdown works well but users need to use CTRL-CLICK to select more than one option which is not a feasible way of selecting.
Any help is greatly appreciated.
Hii you can also use a multiselect dropdown for this.
Use yii select2 for this.
this is nice extension Please read more about this from here
http://www.yiiframework.com/extension/select2/
CMultifileupload working with
<?php echo CHtml::submitButton('Create',array('name'=>'Files')); ?>
as well it $_POST the data to the controller and saves to db
but then if i use
<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
dosent Post any data to the controller
I did tried
$_FILES['Files']
no any change
suppose cmultifileupload is modelA and the other mdoelB
I need to integrate both these model's
modelB has submit as
<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
due which m unable to integrate so the thing is i need both the models in one form and modelB's id to be the Foreign key to modelA to all the images
HOw do i achieve so? Is it possible? please let me know this for the first time am using cmultiuploadfile am working since past a week but then could not figure out whats wrong Please let me know how can i resolve this
You have to add array('name'=>'Files') to your function call:
echo CHtml::submitButton(
($model->isNewRecord ? 'Create' : 'Save'),
array('name'=>'Files')
);
I have a custom index page. I need to have the buddypress registration on the index page. Something like facebook.
Can anyone help?
Thanks
You can simply copy paste the content of theme bp-default/registration/register.php into your page. You can copy everything that is there on register.php between these 2 lines:
<?php do_action( 'bp_before_register_page' ); ?>
and
<?php do_action( 'bp_after_register_page' ); ?>
But, but...
you need to remove this if clause
<?php if ( 'request-details' == bp_get_current_signup_step() ) : ?>
just remove the opening and closing if statement. Everything inbetween should stay as it is. But there's one problem, since you remove this if statement your registration form will always be visible. If you can't live with that then you need to do some workaround to fix this.
On docs we can read:
public static string link(string $text, mixed $url='#', array $htmlOptions=array ( ))
Question:
I don't understand what $htmlOptions means here. I don't understand how to pass from this representation to a real code.
Can anyone please provide an example about how can we generate a link with a class defined.
Something like:
link hello
It's easier than you might think, although Yii's documentation is perhaps a bit more convoluted than needs to be. However, it does say that $htmlOptions is
additional HTML attributes. Besides normal HTML attributes, a few
special attributes are also recognized (see clientChange and tag for
more details.)
In essence, whatever key/value pairs you put into the array will come out as HTML attributes¹. So, what you want to do is
CHtml::link('link hello', '#', array('class' => 'hello'));
¹except the "special" values that the docs refer to, which will not end up rendered in HTML as-is but either modify the way link works slightly, or end up affecting the HTML in other ways.
<?php echo CHtml::link('Link Text',array('controller/action','param1'=>'value1'), array('target'=>'_blank','class'=>'hello'); ?>
It will be shown as below.
<!--if you disabled url manager in "protected/config/main.php" the output will be -->
<a target="_blank" class="hello" href="index.php?r=controller/action¶m1=value1">Link Text</a>
<!--if you enabled url manager in "protected/config/main.php" the output will be -->
<a target="_blank" class="hello" href="controller/action/param1/value1">Link Text</a>
To get a detailed description about CHtml in yii Check this link.
<?php echo CHtml::link("Label Text" , array("/controller_here/action_here") , array('class' => 'class_here')); ?>
or
<?php echo CHtml::link("Label Text" , Yii::app()->createUrl("/controller_here/action_here") , array('class' => 'class_here')); ?>
I want some content to only be printed in my node-type.tpl.php if the node has a certain taxonomy term.
With the following I can print the term's name if its ID is 5:
<?php print $node->taxonomy[5]->name ?>
Can I modify the code so it only prints something if the term ID is 5? I tried the following but it doesn't work:
<?php if ($node->taxonomy == '5'): ?>
Print something here if the term ID is 5.
<?php endif; ?>
Im a bit of a newbie with advanced theming so I was hoping to not have to mess about with my template.php.
It seems more complicated than necessary but could the code from here be altered:
Drupal - display blocks according to node's taxonomy term ID
Thanks
Got it working:
<?php if ($node->taxonomy[5]): ?>
print stuff here
<?php endif; ?>