PDA

View Full Version : Change allowblank on setMode()



vscanas
22 May 2017, 9:35 AM
Hi. I got a question that relates to this is.

I am trying to change the networksearchfield to not have a require field
when it's on modify
In this code for example if you go to setMode (below) it's a function
that changes if the mode is modify then the search field is shown.


//--------------------------
// Change the state of the form
,setMode: function( mode ) {
this.mode = mode ;
var delbut = this.findButton('deletebutton');
if ( mode === 'add' ) {
this.setButtonText('submitbutton','Add') ;
this.hideSearchFields();
// add/hide a 'delete' button ?
if ( delbut ) {
delbut.hide();
}
}
if ( mode === 'modify' ) {
this.setButtonText('submitbutton','Modify') ;
this.showSearchFields();
// add/hide a 'delete' button ?
if ( delbut ) {
delbut.show();
}
}
}


I want to achienve something like this. Any ideas?


setMode: function( mode ) {
this.mode = mode ;

if ( mode === 'add' ) {
allowBlank: true
}

if ( mode === 'modify' ) {
allowBlank: false
}
}

Here is what I am trying to achieve


IB.form.NextIPClass = Ext.extend(IB.form.FieldSet, {
// component defaults
collapsed: false,
checkboxName: 'getnextip',
title: 'Get Next IP Address',
itemID: 'getnextip'

setMode: function( mode ) {
this.mode = mode ;

,initComponent: function () {
//apply ( object, config, [defaults] ) : Object
//Copies all the properties of config to the specified object. There are two levels of defaulting supported:

Ext.apply(this, {
// objects need to go here..
items: [
{
xtype: 'IBNetworkSearchField',
itemID: 'nextipnetwork',
clearForm: false,
searchAlways: true,
width: 'auto',
fieldLabel: 'Network',
setMode: function( mode ) {
if ( mode === 'modify' ) {
allowBlank: false
}

},{
xtype: 'IBNextIPButton',
width: 50
//itemID: 'getnextip',
//name: 'getnextip'
}
]
});