// MinCharsCondition.class.js (Fertile Form JS Framework) || Version: 0.02 || Last Updated: 2010-08-26 17:00 || Updated by: Hidde-Finne Peters || Created: 2010-08-20 by Hidde-Finne Peters
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

var MinCharsCondition = FormCondition.extend({

	init: function (min_chars, feedbackString, fieldObject) {
		this._super(feedbackString, fieldObject);
		
		this.minChars = min_chars;
	},
	
	//	------------------------------------------------------------------------------------------------------------
	//	--- update -------------------------------------------------------------------------------------------------	0.00
	//	------------------------------------------------------------------------------------------------------------
	//	Methods called to change properties dynamically
	
	//	Reanalyze situation and set property "this.valid" accordingly
	updateValid: function () {
		if (this.getValue().length >= this.minChars) {
			this.setValid(true);
			return;
		}
		this._super();
	}
	
	//	------------------------------------------------------------------------------------------------------------
	//	------------------------------------------------------------------------------------------------- update ---
	//	------------------------------------------------------------------------------------------------------------
	
});
