I am trying to get the values of form elements in sencha touch. I am using
fields= form.getFields();
var name = fields["name"].getValue();
This is working for most of my fields, but not for my radio button field.
I am using two radio fields with the same name of 'gender' that have values of male or female. I tried the above code for this field, but I get an error that the radiofield has no method getValue(). However, in the sencha touch documentation under Ext.form.radio it says that radio does have the method. What is the correct way to get the value of a radio group?
Try
var fields = form.getValues();
console.log(fields['name']);
Related
I am making a fillable pdf for a questionnaire in pdf. I have to use radio buttons in the questionnaire. I used the below code snippet to get the value of the radio button group, but it gives me either a null exception or return blank.
I tried a simple code in a blank pdf with just one group of radio buttons with two options and a button.
The code is shown below, where "Group1" refers to the radiobutton group:
var choiceVAL = this.getField("Group1").value; app.alert(choiceVAL);
On clicking the button, the code keeps giving me an exception. I checked all the forums, and this is the code snippet that is used everywhere. I have set the export value to "Y" and "N" respectively.
Can anyone help me with this??
I have a autocomplete field:
I need to set the default value selected for this dropdown using another control value as shown in:
This control is passed to the form load as shown in:
For example if use cost center is 110 as shown in:
Then the default selected value of the Site lookup dropdown needs to be as shown in:
The tricky part is that your Site-Item field isn't a dropdown but an autocomplete. An autocomplete doesn't know all the possible label/values, but can only find some label/values doing a search by label. So you can't tell an autocomplete "set your value to 110", because it doesn't know what the label corresponding to 110 is.
If you knew the label, you could do this programmatically with an fr-set-label, but here you don't have the label but the value. You can read more about this in the section Setting by value. So, my advice is to use a Dynamic Data Dropdown instead of an Autocomplete field.
how can I change single itemtpl at itemtap event in Sencha Touch 2?
I would like to change HTML record's code when I click on item.
If I try to do this with setItemTpl() method on dataview it changes all list's records.
Thanks
On "itemtap" event, you can find the target from params. And then get the target element
var target = Ext.get(target);
then apply, setHtml() function there and do what you want.
I am using ExtJs 4.1. My page is having a combobox and a button. The comboxbox is having a store which uses a model having 4 fields (UserName,ID (uniqueID),Age,Salary). Name is used as display field and Id is used as value field.
What i want:
When the button is clicked I want to see the selected value in the comboxbox and I want to extract the salary.
Possible solution: Get the id of the selected value from the combobox and find the record in the store and extract the salary for that record.
I was wondering if there is more direct approch or method exposed by ExtJS
on combobox select you can get the salary value like this:
onComboboxSelect: function(combo, records, options) {
var selectedValue=combo.getValue();
var record = combo.findRecord(combo.valueField || combo.displayField, selectedValue);
alert(record.get('salary'));
}
I think this is the important then you can for example save this value and display it when the button is clicked..
I've a dijit.form.Combobox field which uses a ItemFileReadStore to pull Its data.
Teh ItemFileReadStore has two attribute per Item value which will be used for form submission , generally Unique Integers and label which is Human Understandable String.
In ComboBox HTML I've done searchAttr="value" labelAttr="label"
When the ComboBox Shows the list it uses teh label Attribute.
But When the User selects one of the Item it shows the value of that Item.
What I want is , The value Attribute will Still be used for Form Submission. But the User will always see the label in the combobox Control.
alt text http://img822.imageshack.us/img822/6660/dijitcombo.jpg
e.g. I Want to Show The Label for value 3 (Admin) instead of 3
Use FilteringSelect instead of Combobox.
Note: ComboBox only has a single value that matches what is displayed while FilteringSelect incorporates a hidden value that corresponds to the displayed value.
I have tried the following.
var cmbObject = Registry.byId('combo dojo id'); var id =
cmbObject.item.<Code Property>;
You should check if item is null.