How to you add html attribute options in Yii radio button? - yii

I am trying to use Yii radioButtonList and customize it with an image on top of each radio button.
However, I'm not sure about how to do it and would be grateful if there's any help.
In the documentation:
public static string radioButtonList(string $name, string $select, array $data, array $htmlOptions=array ( ))
for the $htmlOptions=array(), what can you put in there?
I've seen people using 'separator'=> '', can anyone show some examples?
Thanks in advance.

Try:
'htmlOptions'=>array('size'=>100,'class'=>'yourclass')
basically it's:
'htmlOptions'=>array('validHtmlOption'=>'value','anotherValidHtmlOption'=>'value')

Related

Make Text Field item as Read Only in APEX 5.0

I have some text field page items on my APEX 5.0 page and I want to make the textboxes as read only/non-editable. During the page load I want to use these text boxes for only the data display on the page and should be non-editable.
Can somebody advice on how to do that? What attributes need to set for this?
This answer is a bit late to the party, but I found myself confronted to this problem and I wanted to share the solution I came up with.
In fact you just need to create your item as a text area, let say P1_Text_Area and you give it a readonly attribute using JavaScript. Write thoses 2 lines in the "Function and Global Variable Declaration" of your page:
var disItem = document.getElementById('P1_Text_Area');
disItem.readOnly = true;
Hope this helps someone in need.
in item properties find the
Read Only group
and set Read Only Condition Type as Always
or the option that suits to you
You can use disabled + save session state ==> read only

Html.DropDownList extensions

I have a drop down list in a view bind to a model (MVC4)
#Html.DropDownList("ID_ROLE", String.Empty)
ID_ROLE is one of the property of the model
and ID_ROLE is also the name of the viewbag I pass to the view in this way
ViewBag.ID_ROLE = new SelectList(lista_ruoli.OrderBy(x => x.DESCR_ROLE), "ID_ROLE", "DESCR_ROLE", user_to_edit.ID_ROLE);
In this way it works..
but I don't understand why I can't find an extension of the HtmlHelper.DropDownList
which fits with
#Html.DropDownList("ID_ROLE", String.Empty)
Is this way wrong or not?
Thank you!
Not sure if I understand correctly, but if you want the list to show up in the dropdown, you need to provide the list to the HTML helper:
#Html.DropDownList("ID_ROLE", (SelectList)ViewBag.ID_ROLE)

Avoid empty option element from multiselect box

I am using Zend form and using it i am creating a multi select box. But when the multiselect box is created the first option value is a empty element.. like this
`<option value=""></option>`
I want to avoid this..This is the code i am using..
$addressType_selected = $this>createElement('multiselect','addressType_selected[]')
-> setAttrib('class','float_left input_width_295 k-multiselectbx')
-> setAttrib('tabindex',43);
$addressType_selected->setDecorators(array(
'ViewHelper',
'Errors'
));
What is wrong with my code.. i am stuck with this... Thanks in advance....
I found the answer..
Just used the following script
$("#addressType_selected option[value='']").remove();

Setting datepicker element in Zend_config_Ini

I am trying to create form element using Zend_Config_Ini. Among other elements, I have a datepicker element (zendx_jquery_form_element_datepicker) which fails to work.
I have tried setting the element like so:
user.login.elements.Date.type = "datePicker"
and
user.login.elements.Date.type = "zendx_jquery_form_element_datepicker"
either way ends in the same error message:
Plugin by name 'Zendx_jquery_form_element_datepicker' was not found in the registry; used paths: Zend_Form_Element_: Zend/Form/Element/
or
Plugin by name 'DatePicker' was not found in the registry; used paths: Zend_Form_Element_: Zend/Form/Element/
Please help, thanks.
Just add prefix path before form config
$form = new Zend_Form();
$form->addPrefixPath('ZendX_JQuery_Form_Element', 'ZendX/JQuery/Form/Element', 'element');
$form->setConfig($config->form);
Try
user.login.elements.Date.type = "DatePicker"
The class name is class
ZendX_JQuery_Form_Element_DatePicker
I dont know how to make form using ini file. But I know Zendx_jquery_form_element_datepicker is not standed zend form element. It is make by ZendX. So you cant use it as zend element.

JUI Autocomplete html-encoded suggestions

jQuery UI starting from version 1.8.4 html-encodes Autocomplete suggestions (according to this issue).
This became a problem for me now. I used to theme the output for the suggestions, but now (if I use version 1.8.4 or higher) Autocomplete just html-encodes my theming. All tags like <b>, <span> are being printed to the user instead of displaying the actual styling.
So the suggestions now look like:
<b>su<b>suggestion
another <b>su<b>suggestion
instead of:
suggestion
another suggesion
I've read about custom data, but I use Yii framework and the output is being generated from certain actions (PHP code).
So, how do I theme the output now?
Thank you!
Better use a HTML plugin
You can use open function from jQuery UI to replace the encoded text.
Here's an example:
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'name'=>"bug",
'source'=>$this->createUrl('/autocomplete'),
// additional javascript options for the autocomplete plugin
'options'=>array(
'open'=> 'js:function(event, ui){
$("ul.ui-autocomplete li a").each(function(){
var htmlString = $(this).html().replace(/</g, "<");
htmlString = htmlString.replace(/>/g, ">");
$(this).html(htmlString);
});
}'
),
));