I am using zend form to create an radio button element. How do I align them horizontally.
$this->addElement('radio', 'howYouFeel3', array(
'onClick' => 'showFields(this);',
'required' => true,
'multiOptions' => array(
'Positive' => 'Positive',
'negative' => 'Negative',
)
));
I have tried adding:
'setSep' => '',
and
'separator' => '',
and
'setSeparator' => ''
But none worked.
Also tried:
$howYouFeel3 = new Zend_Form_Element_Radio('howYouFeel3');
$howYouFeel3
->setLabel('How you Feel?')
->setSeparator('')
->addMultiOptions(array(
'positive' => 'Positive',
'negative' => 'Negative'
));
$this->addElement($howYouFeel3);
Have looked at the source code and it seems the code is creating the radio buttons in li tags in an ul unlike others in the situation with the same problem who have an at the end. This is perhaps why the seperator thing doesnt work.
This question has been asked before
here, the accepted answer should show you how to go about this.
Edit:
Have you tried: array("listsep" => ' ')
It seems to be the universal solution, here is another example
You can use setSeperator function to align the radiobuttons
$radio= new Zend_Form_Element_Radio('status');
$radio->setSeparator(' ');
Related
I am new to php and yii framework. I want to do a dropdownlist with matching result. But if you want to type for example at least 3 or 4 letters to get result. If you type 3 numbers or letters the dropdownlist will open automatically and let you see all words/numbers that has the 3 letters/numbers consecutive.
I checked this site.
http://www.yiiframework.com/wiki/48/by-example-chtml/#hh5
But I dont know where I can set the condition for what I want to do. Thanks a lot.
In view page,
$term = CHtml::listData(Term::model()->findAll(), 'termid', 'term_name');//!< $term to select term details
echo CHtml::activeDropDownList($model, 'termid', $term, array(
'empty' => Yii::t('app','Select Term'), 'class' => "form-control",
));
have a look at http://yiiwheels.2amigos.us/ they have really good widgets that can help you. http://yiiwheels.2amigos.us/site/inputs#select2 will be of great help to you.
$term = CHtml::listData(Term::model()->findAll(), 'termid', 'term_name');
$this->widget('yiiwheels.widgets.select2.WhSelect2', array(
'asDropDownList' => true,
'model' => $model,
'attribute'=>'attribute'
'pluginOptions' => array(
'tags' => $term,
'placeholder' => 'type 2amigos',
'width' => '40%',
'tokenSeparators' => array(',', ' ')
)));
haven't tested it though,
I'm using Yiibooster and the TbGridView to show some results. I'm also using the following code to provide smart looking icons to a view, update and delete link.
array(
'htmlOptions' => array('nowrap'=>'nowrap'),
'class'=>'bootstrap.widgets.TbButtonColumn',
'viewButtonUrl'=>'Yii::app()->createUrl("/item/view", array("id"=>$data["id"], "sector" => $data["sector"]["slug"],"title" => $data["slug"]))',
'updateButtonUrl'=>'Yii::app()->createUrl("/item/update", array("id"=>$data["id"]))',
'deleteButtonUrl'=>null,
)
What I'd like to do is basically be able to show another button in there or in replace of the delete button. I'm just unsure how (or where specifically) I need to code the values for the this button.
I'm currently looking at the TbButtonColumn.php file and tried just adding a button just to see if it would work it didn't.
What would be the correct process to to do this?
Thanks in advance
Jonny
There is a buttons parameter for additional buttons, it is in docs od CButtonColumns, here is sample from link:
array(
'class'=>'CButtonColumn',
// Template to set order of buttons
'template' => '{postview} {preview}',
// Buttons config
'buttons' => array(
'postview' => array(
'label' => '...', // text label of the button
'url' => '...', // the PHP expression for generating the URL of the button
'imageUrl' => '...', // image URL of the button. If not set or false, a text link is used
'options' => array(...), // HTML options for the button tag
'click' => '...', // a JS function to be invoked when the button is clicked
),
'preview' => array(
// Another button config
),
),
),
NOTE: This is example for CButtonColumn but TbButtonColumn is a subclass of CButtonColumn, so everything applies to both.
I am helping a buddy out and modifying his Wordpress portfolio for him. I don't use php very often so this might be something simple.
In a template I am calling the Wordpress the_field() method like so:
<?php echo the_field('full_text'); ?>
This is outputting the content of the full_text just fine however the full_text does contain an <a> tag which is not being generated as a link and is showing up as:
The Link
instead of actually generating the link.
What do I need to do to get any HTML contained in the full_text field to show up as HTML and not plain text?
Edit
In custom_fields.php I've found:
array (
'key' => 'field_4',
'label' => 'Full Text',
'name' => 'full_text',
'type' => 'textarea',
'order_no' => 2,
'instructions' => 'Write about this item.',
'required' => 0,
'conditional_logic' =>
array (
'status' => 0,
'rules' =>
array (
0 =>
array (
'field' => 'null',
'operator' => '==',
'value' => '',
),
),
'allorany' => 'all',
),
'default_value' => '',
'formatting' => 'br',
),
It seems like you're using Advanced Custom Fields. If so, you need to turn off the "filter content" setting to get the link to show up.
Thanks to mcrtr I was informed that the template he was using was using Advanced Custom Fields digging deeper I found the field full_text was of type textarea by changing it to wysiwyg it no longer outputted as plain text.
When setting up the field, change the formatting option to HTML instead of none and it'll keep the <a> tag around your link.
You don't need to change it to WYSIWYG in order to keep links as links in ACF.
so, I want to make a new button in my CGridView. This is up & down arrow buttons which is will be used for sorting my articles. I've read a lot of how to make this kind of buttons. I already read the wiki of how to use this CGridView button also in this link.
And now I have this in my view :
array(
'header' => 'Action',
'class' => 'CButtonColumn',
'template' => '{moveup}{movedown}{view}{delete}',
'htmlOptions' => array('style' => 'width: 68px'),
'buttons' => array
(
'moveup' => array
(
'label' => 'Move Up',
'imageUrl' => Yii::app()->request->baseUrl . '/images/move_up.png',
'url' => 'Yii::app()->createUrl("KB/moveup", array("id"=>$data->KBID))',
'visible' => '$data->KBORDER == KB::model()->getMax()',
),
'movedown' => array
(
'label' => 'Move Down',
'imageUrl' => Yii::app()->request->baseUrl . '/images/move_down.png',
'url' => 'Yii::app()->createUrl("KB/movedown", array("id"=>$data->KBID))',
'visible' => '$data->KBORDER == KB::model()->getMin()',
),
),
),
and this one in my model :
public function getMax(){
$sql = 'SELECT MAX(KBORDER) FROM KB';
$max = Yii::app()->db->createCommand($sql);
$max->queryAll();
return $max;
}
public function getMin(){
$sql = 'SELECT MIN(KBORDER) FROM KB';
$min = Yii::app()->db->createCommand($sql);
$min->queryAll();
return $min;
}
All that codes running just fine. except for the visibility. I want to make the up button become invisible when it has the highest value of KBORDER or when it position is in the 1st place. And for the down button, it supposed to be invisible too when it has the lowest value of KBORDER or when it position is in the last place. but, when I put that code in my 'visible', all the buttons are invicible.
so my question is, how to make my request happen?
thanks in advance
First off, queryAll returns an array. Documentation. So you should probably use queryScalar, and you should return the result from the function, not the command object.
return $max->queryScalar();
You could also use a statistical query in Yii.
Secondly, you want to SHOW the button when it is not in the top or bottom respectivily, so you should negate the =
'visible' => '$data->KBORDER != KB::model()->getMax()',
and
'visible' => '$data->KBORDER != KB::model()->getMin()',
I am using CakePHP and the FormHelper to generate my form.
However, I need to create a markup similar to the following structure:
(radio1) [TEXT_INPUT] or more credits
(radio2) No Limit
Now, I am not sure how to approach this, but logically I would imagine it to be something like:
$options = array(
'oneormore' => $this->Form->input( 'text_for_oneormore' ) . ' or more credits',
'nolimit' => 'No Limit'
);
echo $this->Html->radio( 'quantity', $options, array() );
Does anyone have any ideas they can offer? I am stumped on this issue.
One way would be to use the 'before' and 'after' options which append the string you put in there. I think you can get away with entire fields there.
http://book.cakephp.org/view/1393/options-before-options-between-options-separator-a
Another way would be to make your own helper based on the FormHelper.
I may be a bit late to the show, but I came across this issue in upgrading a site to cakephp 2.x. I found if I use the "'hiddenField' => false" option, I was able the separate the radio buttons and put text or select inputs between them:
Your question relates to which of the following:<br>
<?php
echo $this->Form->radio("qOption", array('0' => 'Find a store'), array("label" => false, 'hiddenField' => false));
echo $this->Form->radio("qOption", array('2' => 'Choose a Product'), array("label" => false, 'hiddenField' => false));
echo $this->Form->select('product', $products, array());
echo $this->Form->radio("qOption", array('1' => 'Other'), array("label" => false, 'hiddenField' => false));
echo $this->Form->input("other", array("class"=>"f_12_darkgray", "size"=>"40", 'div' => false, "label" => false));
?>