I'm getting a strange behavior when binding the following object to a select:
REGIONSH = {0:"All Regions",1:"Europe",2:"North America"};
HTML (where region is a integer for key):
<select ng-model="REGIONSH[region]" ng-options="name for(key,name) in REGIONSH">
The behavior is that the list is populated correctly with the correct option selected, but when I change the region variable the selected entry changes fine, but suddenly both the original and the new selections are named the same thing.
For example, I would select the second element in the list, and the original one would be renamed to "North America" from "All Regions".
The desired behavior is to have a select where I can chose from each of the values in the object while having the key as the option's value.
The way you have your html:
<select ng-model="REGIONSH[region]" ng-options="name for(key,name) in REGIONSH">
It will display the list correctly, but whenever the user makes a choice the name of the region ("name for(key,name)") will be bound to wherever ng-model is pointing to.
Meaning when the user makes a choice for say the first option, it ng-model will effectively perform
REGIONSH[region] = /*name of the selected region*/;
Which assigns a name to the region at index region.
What you probably want is ng-model="region", so the values are assigned to the region variable, and not the options. ( Or any other variable you want to store the choice in; probably not in REGIONSH though )
Then you'd also need ng-options="key as name for (key, name) in REGIONSH, so that it still displays the name, but now assigns key whenever the user makes a selection. ( Read here on the many ng-options formats you can use )
Meaning when a selection is made it performs
region = /*key of the selected region*/;
The final result would be
<select ng-model="region" ng-options="key as name for(key,name) in REGIONSH">
Related
I have a page within my app with a Checkbox option.
The idea is basically to allow the user to select/unselect it if the change needs to be applied for every Sales Rep.
Something like this:
If checkbox is clicked = Change would be applied to all territories owned by the Rep
If checkbox is not clicked = Change would only be applied to the selected territory
I can't seem to get the checkbox clicked option to work.
I'm using an instr function to get a value out of it but it doesn't work:
select instr(':' ||:P11_CHECK_FOR_ALL|| ':', 'Request') into v_number_terr from dual;
if v_number_terr >0
(P11_CHECK_FOR_ALL is my checkbox Item / 'Request' is a word that's part of its label)
my checkbox pic
I'm trying to capture (in a process) whether the option is checked or not.
Could someone give me a hand please?
Thanks!
In apex a checkbox behaves just like a select list (with multiple selects possible). There is a display value and a return value. If nothing is selected, the page item value will be null. If one or more value are selected, the page item will contain a colon separated list of selected return values.
To handle the select list in a page process, the easiest is to split up the colon separated list in individual values using APEX_STRING.SPLIT
Example (untested):
DECLARE
l_check_for_all apex_t_varchar2;
BEGIN
l_check_for_all := apex_string.split(:P11_CHECK_FOR_ALL,':');
-- loop through the values. If nothing is selected then the COUNT will be 0 and nothing will be executed.
FOR i IN 1 .. l_check_for_all.COUNT LOOP
// do your pl/sql magic. You can reference the current item with l_check_for_all(i)
END LOOP;
END;
In NETSUITE
is there any way to access to a value inside of a combo-box at the item line level?
I need to access to a value after inserting an item but all functions get me null value.
I have tried
nlapiGetCurrentLineItemValue
and
nlapiGetFieldValue
Both functions are getting me null values.
Thanks,
Pablo.
In general (for user event and client script) below code should work
nlapiGetLineItemValue(LINE_ITEM_TYPE, YOUR_FIELD_ID, LINE_NUMBER);
eg on SO to get the line item Id:
nlapiGetLineItemValue('item', 'item', 1);
PS: Syntax is independent of data type or field type
If you mean combo box as a mulitselect, and if you're trying to access via User Event Script, use:
nlapiGetLineItemValues(type, fldname, linenum);
Note the 's' in nlapiGetLineItemValues
If its just a standard field, nlapiGetLineItemValue(type, fldname, linenum) should work.
Which call to use depends on what event you are capturing.
For instance if you are trying to access the value in a post sourcing, field changed or line validate event of a client script you would use nlapiGetCurrentLineItemValue('item', 'fieldname');
I have a webform with a textfield.
The webform is connected to an integral database. But for this I don't need to store the value from this radiobutton into a table. I just want to take that value, and use it as a return for another field, just like it was not connected to a database at all.
In my TSQL code I assigned this textfield to a variable like this:
DECLARE #vak1 int
SET #vak1 = '[field name='vak1']'.
'field name' is the name of the object of that textfield. And I named it vak1.
I also want to put the checkedvalue from a radiobutton control into a variable, just like I did in the example above. But I dont know the name of the object, like in the above example it is field name for a textfield. So I need to know the standard name of a radiobutton object. These are all being used as LOCAL variables.
For example:
DECLARE #radio int
SET #radio = '[ x = 'No_cure_no_pay']'
The name No_cure_no_pay is the name of the radiobutton object. But what should I call x here? In the upper example it is 'field name' for a text field webcontrol.
What is the name for a radio button webcontrol?
The software I am using is custom made 3rd party software by a local Dutch company and it is not well known. So I cannot provide much info on the internals of the database. I don't have much code. Just these two lines would suffice, because the rest is pretty much the same just with different variable names. I will just use the values as return values. Just need to know how to declare and set a checked radiobutton value.
I have a webform with a textfield.
The webform is connected to an integral database. But for this I don't need to store the value from this radiobutton into a table. I just want to take that value, and use it as a return for another field, just like it was not connected to a database at all.
In my TSQL code I assigned this textfield to a variable like this:
DECLARE #vak1 int
SET #vak1 = '[field name='vak1']'.
'field name' is the name of the object of that textfield. And I named it vak1.
I also want to put the checkedvalue from a radiobutton control into a variable, just like I did in the example above. But I dont know the name of the object, like in the above example it is field name for a textfield. So I need to know the standard name of a radiobutton object. These are all being used as LOCAL variables.
For example:
DECLARE #radio int
SET #radio = '[ x = 'No_cure_no_pay']'
The name No_cure_no_pay is the name of the radiobutton object. But what should I call x here? In the upper example it is 'field name' for a text field webcontrol.
What is the name for a radio button webcontrol?
The software I am using is custom made 3rd party software by a local Dutch company and it is not well known. So I cannot provide much info on the internals of the database. I don't have much code. Just these two lines would suffice, because the rest is pretty much the same just with different variable names. I will just use the values as return values. Just need to know how to declare and set a checked radiobutton value.
I have cascading select where the value in the first decided what should be the option of others.
When I change the value of the first select so that the currently selected value in one other is no more a possible choice, I get a null (empty) choice. In place, I want to get a default, not null, value (of course, I don't want to reset to a default value is the choice is still legit).
I looked to (rather) similar question like Why does AngularJS include an empty option in select? but is does not seem to work, perhaps because my options are not predefined but generated on change.
I set-up a jsfiddle with the actual code: http://jsfiddle.net/sXu9a/
choose 2 hours or greater on the first select
chosse 1 in the second select (start hour)
choose back less than 1 hour in the first select
=> the second select display a empty option, and the "startHour" model still contains the last selected value (which is no more a valid choice). I really want to update the ng-model for that option to be reseted to 0.
In fact, I would like to be able to encode the condition: "if current model value for selected option is not in the set of possible value, reassign to model a default value (0)". So I tried a "onChange" like that:
$scope.onChangeInterval = function() {
if(jQuery.inArray($scope.agentSchedule.startHour, $scope.startHours() ) ) {
$scope.agentSchedule.startHour = $scope.startHours()[0];
}
}
But that does not seem to work.
Any idea about that ?
So, it happens that the "onChange" solution DOES work, as long as you don't make typos in the variable of your name. So with the following code (onChange is called on the first select):
$scope.onChangeInterval = function() {
if(jQuery.inArray($scope.agentSchedule.startHour, $scope.hours() ) ) {
$scope.agentSchedule.startHour = $scope.hours()[0];
}
}
Sorry for the noise!