selected

PHP How can I keep the selected option from a drop down to stay selected on submit?

亡梦爱人 提交于 2019-12-02 17:50:39
问题 I have: <select name="topic" style="margin-bottom:3px;"> <option>General Question</option> <option>Company Information</option> <option>Customer Issue</option> <option>Supplier Issue</option> <option>Request For Quote</option> <option>Other</option> </select> for the drop down. And when the form is submitted, It goes to a validation page. If it has errors the form keeps the original content the user put in. I have it working for all of the input fields and textarea's, but how could I do this

How to set the 'selected option' of a select dropdown list with jquery

邮差的信 提交于 2019-12-02 17:07:55
I have the following jquery function: $.post('GetSalesRepfromCustomer', { data: selectedObj.value }, function (result) { alert(result[0]); $('select[name^="salesrep"]').val(result[0]); }); result[0] is a value that I want to set as the selected item in my select box. result[0] equals Bruce jones . the select box is populated by a database query but one of the rendered html is: <select id="salesrep" data-theme="a" data-mini="true" name="salesrep"> <option value=""> </option> <option value="john smith">john smith</option> <option value="Bruce Jones">Bruce Jones</option> <option value="Adam

yii -> dropDownList -> CHtml::listData -> set selected value

爱⌒轻易说出口 提交于 2019-12-02 13:41:38
问题 How can I set the selected value in the following statement: echo $form->dropDownList( $model, 'land_id', CHtml::listData(ListeLand::model()->findAll(), 'iso', 'landname'), array('class'=>'span4 chosen','maxlength'=>20) ); I want to set in the list: iso = AT landname = Österreich as selected value. EDITED -> The solution: echo $form->dropDownList( $model, 'land_id', CHtml::listData(ListeLand::model()->findAll(), 'iso', 'landname'), array( 'class'=>'span4 chosen', 'maxlength'=>20, 'options' =>

PHP How can I keep the selected option from a drop down to stay selected on submit?

跟風遠走 提交于 2019-12-02 10:28:00
I have: <select name="topic" style="margin-bottom:3px;"> <option>General Question</option> <option>Company Information</option> <option>Customer Issue</option> <option>Supplier Issue</option> <option>Request For Quote</option> <option>Other</option> </select> for the drop down. And when the form is submitted, It goes to a validation page. If it has errors the form keeps the original content the user put in. I have it working for all of the input fields and textarea's, but how could I do this with a drop down? I have the input fields staying by using: $name = $_REQUEST["name"]; and in the form

jqGrid how to collapse row when clicking on other row

别来无恙 提交于 2019-12-02 08:50:28
In a main grid, when I click on one row, it become 'highlighted' and the seven subgrids are showed. Here is an example where first row is selected, and near to be edited (work in progress) : Now, if I click on second row of the main grid, the first is hidden and the second selected. I click after on edit button and a warning appears : no selected row ! If I click again on the second row, it become unselected, and again I click for selecting and editing, that runs fine ! So I presume that my code for switching between collapsed and expanded status is somewhere wrong : UPDATED 2013-04-11

yii -> dropDownList -> CHtml::listData -> set selected value

戏子无情 提交于 2019-12-02 04:30:34
How can I set the selected value in the following statement: echo $form->dropDownList( $model, 'land_id', CHtml::listData(ListeLand::model()->findAll(), 'iso', 'landname'), array('class'=>'span4 chosen','maxlength'=>20) ); I want to set in the list: iso = AT landname = Österreich as selected value. EDITED -> The solution: echo $form->dropDownList( $model, 'land_id', CHtml::listData(ListeLand::model()->findAll(), 'iso', 'landname'), array( 'class'=>'span4 chosen', 'maxlength'=>20, 'options' => array('AT'=>array('selected'=>true)), ) ); this works.. echo $form->dropDownList( $model, 'land_id',

CakePHP 2.0 Select form Mulitple selected

被刻印的时光 ゝ 提交于 2019-12-01 19:04:54
Ok, so I have have this dropdown menu where you can select multiple values. Now lets say I want to edit my info and make a dropdown menu with multiple selected values. Trying to figure out how it goes, but no results. Lets say I have: $selected = array(3, 4); $options = array(1,2,3,4); echo $this->Form->select('Attendees', $options,array('multiple' => true, 'selected' => $selected)); I've used this code, but nothing is selected. Ok found a way, appearantly it needs to be like this: $selected = array(2, 3); $options = array(1, 2, 3, 4); echo $this->Form->input('Attendees', array('multiple' =>

p:selectOneMenu preselects previous item when noSelectionOption item is present

杀马特。学长 韩版系。学妹 提交于 2019-12-01 18:13:17
问题 There is a problem with p:selectOneMenu selection when adding a f:selectItem . View: <p:selectOneMenu value="#{selectionTest.selectedName}"> <f:selectItem itemLabel="Select" noSelectionOption="true" /> <f:selectItems value="#{selectionTest.allNames}" var="varName" itemLabel="#{varName}" itemValue="#{varName}" /> </p:selectOneMenu> Model: private List<String> allNames; private String selectedName; public MenuSelectionTestBean(){ allNames = new ArrayList<String>(); allNames.add("Ahmed");

Encountered IndexOutOfBoundException while removing items from ListView in Android?

寵の児 提交于 2019-12-01 14:20:52
I have one simple_list_item_multiple_choice listview in my layout and i am trying to remove all the selected items from it. I know how to delete it but i am having two major problems while deleting the items :- My program isn't deleting more than 2 items like if i selected 4 items then only 2 will be deleted and sometime its even deleting the wrong items. When i debug my code i found Array IndexOutOfBoundException in my code and as far as i know there is no exception like this in my code and its all because of deleting the wrong or less items. here is my code:- public void onClick(View view) {

Encountered IndexOutOfBoundException while removing items from ListView in Android?

这一生的挚爱 提交于 2019-12-01 13:21:45
问题 I have one simple_list_item_multiple_choice listview in my layout and i am trying to remove all the selected items from it. I know how to delete it but i am having two major problems while deleting the items :- My program isn't deleting more than 2 items like if i selected 4 items then only 2 will be deleted and sometime its even deleting the wrong items. When i debug my code i found Array IndexOutOfBoundException in my code and as far as i know there is no exception like this in my code and