function func(self) { return [ { name: 'tablewidgt', type: 'TabWidget', property: {stylesheet:"QTabWidget{background-color:red}"}, pack: { stretch: 1 }, child: { name: 'userinfo_page', type: 'ScrollArea', property: { widget_resizable: true, frame_shape: 'NoFrame'}, pack: { label: self.ttr("User Information") }, child: { name: 'formlayout', type: 'FormLayout', property: { label_alignment: 'AlignRight', margin: 20, vertical_spacing: 10, horizontal_spacing: 20 }, pack: {}, child: [ { name: 'id', type: 'LineEdit', title: self.ttr('ID'), property: { enabled: false }, pack: { label: self.ttr('ID') }, state: function(obj) { return "Hide"; } }, { name: 'username', type: 'LineEdit', title: self.ttr('Login Name'), property: {}, pack: { label: self.ttr('Login Name') }, validate: function (obj, val, title, moment, self) { if (val.trim() == '') { return [title + self.ttr(" can not be null"), 'Error']; } else if (!val.match(new RegExp('^[A-Za-z0-9_]+$'))) { return [title + self.ttr(" can only contain [A-Za-z0-9]!"), 'Error']; } }, }, { name: 'password', type: 'LineEdit', title: self.ttr('Password'), property: { echo_mode: 'Password' }, pack: { label: self.ttr('Password') }, state: function(obj,self) { return 'Hide'; } }, { name: 'fullname', type: 'LineEdit', title: self.ttr('Full Name'), property: {}, pack: { label: self.ttr('Full Name') }, validate: 'NOTNULL' }, { name: 'staffid', type: 'LineEdit', title: self.ttr('Staff ID'), property: {}, pack: { label: self.ttr('Staff ID') }, }, { name: 'contcat_id', type: 'LineEdit', property: { enabled: false }, state: function(obj,self) { return 'Hide'; } }, { name: 'mail', type: 'LineEdit', title: self.ttr('Mail'), property: {}, validate: function (obj, val, title, moment) { if (val != '') { var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; if (!filter.test(val)) { return [self.ttr("invalid mail format"), 'ERROR'] } } }, pack: { label: self.ttr('Mail') }, }, { name: 'remark', type: 'PlainTextEdit', title: self.ttr('Remark'), property: { vertical_scroll_bar_policy: 'ScrollBarAlwaysOff' }, pack: { label: self.ttr('Remark') }, }, { name: 'status', type: 'ComboBox', title: self.ttr('Status'), property: { item_list: TOPENM.enumList("sys-user-status").toComboList() }, pack: { label: self.ttr('Status') }, validate: function (obj, val, title, moment, self) { if (val.trim() == '') { return [title + self.ttr(" can not be null"), 'Error']; } } } ] } } }, ]; }