Hi,
Using smart office JScript I need to set a value to the combo box. For example in MMS002/E item status is a combo box. I need to set the status value to 10 for new records.
What is the command to set the values in a combo box?
Thanks
Fazlan
@mohammedfazlan-haniffa
Please try the below.
combobox.SelectedValue = "10";
combobox.SelectedValue =
"10"
;
Did you get a chance to try the above?
Is fhe value 10 in combo List?
In Smart Office you should be able to use the "Text".Here is an example I have for CRS692 to "Disable" specific Fields based on Status selected from Combo if it helps.
-------------------------------------------
import System;import System.Windows;import System.Windows.Controls;import System.Windows.Input;import MForms;import Mango.UI;import Mango.UI.Core;import Mango.UI.Core.Util;import Mango.UI.Services;import Mango.UI.Services.Lists;import Lawson.M3.MI;
package MForms.JScript {
class CRS692_SecureBankAccount { var debug, content, controller; var isTextChanging: boolean = false; // to avoid infinite loop in OnTextChanged var STAT: ComboBox; //Status var BF09: TextBox; //ABA Name var BF12: TextBox; //Account Number or Routing number var BF15: TextBox; //Account Number var CTSV: String; //Std Cost Type var CTAM: String; //MO Variation Cost Type (**NEW) var firstRec: int = 1; //First record? var listControl: MForms.ListControl;
public function Init(element: Object, args: Object, controller : Object, debug : Object) { content = controller.RenderEngine.Content; listControl = controller.RenderEngine.ListControl; this.controller = controller; this.debug = debug;
try { var fieldName = "WWSTAT"; if(ScriptUtil.FindChild(content, fieldName) == null) { debug.WriteLine("TextBox WWSTAT not found."); return; } STAT = ScriptUtil.FindChild(content, fieldName); debug.WriteLine("STAT = " + STAT.Text); fieldName = "W2BF15"; BF15 = ScriptUtil.FindChild(content, fieldName); fieldName = "W2BF12"; BF12 = ScriptUtil.FindChild(content, fieldName); fieldName = "W1BF09"; BF09 = ScriptUtil.FindChild(content, fieldName); if (STAT != null) { debug.WriteLine("Init: STAT=" + STAT.Text); if(STAT.Text == "20-Definite") { BF09.Style = StyleManager.StyleTextBoxDisabled; BF12.Style = StyleManager.StyleTextBoxDisabled; BF15.Style = StyleManager.StyleTextBoxDisabled; } else { } } } catch (ex: Exception) { ConfirmDialog.ShowErrorDialog('init: Script', ex); MessageBox.Show('Init: Error: Exception generated.'); }
} }}
// at this point STAT is never null
if (STAT != null) {
..........
}
OMG!! That's what you got out of this?? Did you even read the Q!?
because if null the previsou line will throw a error
STAT = ScriptUtil.FindChild(content, fieldName);debug.WriteLine("STAT = " + STAT.Text);