textArea non obbligatoria

Non capisco,

nella tabella mysql ho un campo: fwdrccr text NOT NULL,

Nel nella funzione rules() del modello mi crea automaticamente il campo fwdrccr come required.




	public function rules()

	{

		// NOTE: you should only define rules for those attributes that

		// will receive user inputs.

		return array(

			//array('alias, fwdrccr', 'required'), // creato automaticamente

			array('alias', 'required'),            // desiderato ma non funzionante

			array('account, tipo', 'length', 'max'=>50),

			// The following rule is used by search().

			// Please remove those attributes that should not be searched.

			array('id, account, alias, fwdrccr, tipo', 'safe', 'on'=>'search'),

		);

	}



Se tengo il campo nell’elenco dei ‘required’ funziona tutto ma ovviamente il campo non può essere vuoto.

Se elimino il campo dall’elenco dei ‘required’ (per consentire il campo vuoto) la modifica del campo non funziona più… senza alcuna segnalazione… perchè?

yii Version 1.1.10

Se su mysql è not null, vuol dire che non può essere null. E questa è la ragione per cui yii lo genera required. Se tu, poi, togli il required. Invii un form con quel campo vuoto e quando cerchi di salvare un record null, ti da errore. Se dai la possibilità, a quel campo, di essere null, funzionerà.