How to bind Display name of Dropdown value into Textbox field - infopath

Drop Down Filed name : DD
Text Field name : Text
My infopath form drop down field (DD) value bind using "Enter Choice manually"
Drop down Values
Value Display Name
1 One
2 Two
3 Three
4 Four
5 Five
On button click I set action "set field value"
In field i select Text , In value field i select DD
If i select option two in dropdown In Text field its value shown as "2" but i need Text field should be Two.
How to resolve this...

Either change the value of drop down to "Two" in drop down settings OR create a rule before setting the TEXT field that converts the "2" to "Two".
Rule should be
CONDITION: If DD = 2
ACTION Set TEXT field to "Two"
Then create other rules for 1,3,4 and 5.

Related

Drupal - How to use Computed field in field collection item fields

I have custom content type type_a
Inside that custom type I have few titles
Title
Body
Group1 (field_group1) (Field Collection Item Can have multiple values)
Following are the details of fields inside Group1 (Field Collection Item)
Group Item 1 (field_item1) Can have one value
Group Item 2 (field_item2) (Computed field) Can have one value
I would like to copy value of "Group Item 1" field of same field collection item inside "Group Item 2"
Below is I am using in computed code:
$entity_field[0]['value'] = $entity->field_item1[LANGUAGE_NONE][0]['value'];
But it is not working. I am getting an error
Notice: Undefined index: value in eval() (line 1 of /homepages/13/d160804/htdocs/test/sites/all/modules/computed_field/computed_field.module(466) : eval()'d code).
Please help how to do this. Thanks
$entity->field_item1[LANGUAGE_NONE][0]['value'] contains the entity id of the field collection item (which contains the fields you want to copy).
You either need to load both field collection items and set their individual fields. Eg,
$source_fc = field_collection_item_load($entity->field_item1[LANGUAGE_NONE][0]['value']);
$dest_fc = field_collection_item_load($entity->field_item2[LANGUAGE_NONE][0]['value']);
// now set values of $dest_fc with values from $source_fc
Or do some sort of clone similar to this method: http://drupal.org/node/1233256#comment-5167316

A GridColumn having columnEdit set as RepositoryItemComboBox , on changing SelectedItem, Old Item persists

A gridCoumn is defined in a Devex Xtra GridControl(winform type).
This column has two properties set :
FieldName --> a field name of a column in dataSource. OptionType
ColumnEdit --> as a RepositoryItemCombobox object , this object's 'Items' properties is having two value : Option1 , option2 & option3.
When data is set at runtime , the GridColumn shows the respective values in 'OptionType' column.
But now i cant change the values in any combobox of this column to other option by using the dropDown.
What am i missing ?????

If 2 dropdown showing same value on selected index change

I have been asked question on this scenario.There are 2 dropdownlist populating same data from same table one at top and other at bottom.when Item in first dropdownlist get selected,same item is shown in second dropdownlist and second item get selected,same item is selected in first.That means it is continuous loop.How to handle this situation. Don't want to use query
select name from table where id = ddl1.selecteditem.value and execute it.
On selectedindex function of dropdownlist1,he wrote like this
ddl2.selectedItem.value = ddl.selectedItem.value
and second list
ddl.selectedItem.value = ddl2.selectedItem.value
Does it possible to select the value from these 2 statement?I done like this,but not working.
In order to get the same value in both dropdownlists you need to do this in your dropdownlist1_selectedindexchanged:
DropDownList2.Items.FindByValue(DropDownList1.SelectedValue).Selected = true;
The same in dropdownlist2_selectedindexchanged:
DropDownList1.Items.FindByValue(DropDownList2.SelectedValue).Selected = true;
This should keep the same value in both dropdownlists whenever they have been modified.

'Not selected' property value on drop down box selected value

I have an ASP.NET site (either .NET 2.0 or 3.5), and I want to get the selected item of two drop down boxes (call them a and b). B is updated with appropriate values depending on what is selected for A.
However, the following code:
string val = dd1.SelectedItem.Text;
Returns a value of "not selected". Why is this?
Thanks
The only way this could happen is if you have "not selected" set as either the Text property of your selected item, or if Text is null then the Value property will be returned.
From MSDN's documentation on ListItem (which is what SelectedItem inherits from):
If the Text property contains null,
the get accessor returns the value of
the Value property. If the Value
property, in turn, contains null,
String.Empty is returned.

How to change value of TemplateField dynamically?

I have a GridView and I want to refresh a row (not the whole grid) when it gets selected. I tried to change Text property for each of GridView.SelectedRow.Cells when Grid selected index changes. It seems to work for DataField, but not for TemplateField. For TemplateField I got strange results - the value for selected row changes properly, but when I select another row, the value of TemplateField for previously selected row becomes blank. Brief illustration :
1. Nothing selected
--------------------------
id template_field
--------------------------
1 value_1
2 value_2
2. First record selected
--------------------------
id template_field
--------------------------
1 updated_value_1
2 value_2
3. Second record selected
--------------------------
id template_field
--------------------------
1 [blank!]
2 updated_value_2
Eventually, I end up with blank template_field for each record except selected. What is the proper way to change the text of TemplateField ?
Try adding a TextBox control to your template, and change it instead of the cell contents. You should be able to get at it via something like this:
TextBox tb = GridView.SelectedRow.Cells[0].Controls[0] as TextBox;
if(tb != null)
tb.Text = newValue;

Resources