"use strict"; function SmartFormsIsIE8OrEarlier(){ return navigator.appVersion.indexOf("MSIE 7.")!=-1||navigator.appVersion.indexOf("MSIE 8.")!=-1||navigator.appVersion.indexOf("MSIE 9.")!=-1; } var SmartFormsStyleScopeField=1; var SmartFormsStyleScopeType=2; var SmartFormsStyleScopeAll=3; function RedNaoGetValueFromArray(array){ var value=0; for(var i=0;i') }; sfFormElementBase.prototype.HideLoadingBox=function(){ this.JQueryElement.find('.rnLoadingbBox').remove(); }; sfFormElementBase.prototype.SetGlobalProperties=function(){ if(this.IsNew) this.Options.Spacing='col-sm-12'; else this.SetDefaultIfUndefined('Spacing','col-sm-12'); }; sfFormElementBase.prototype.SetData=function(data){ }; sfFormElementBase.prototype.Ignore=function(){ if(this._ignore===true) return; this._ignore=true; this.FirePropertyChanged(); }; sfFormElementBase.prototype.GetStepId=function(){ if(typeof this.Options.StepId=='undefined') return ''; return this.Options.StepId; }; sfFormElementBase.prototype.SetStepId=function(stepId){ this.Options.StepId=stepId; }; sfFormElementBase.prototype.Hide=function(requestId){ if(this.ShowRequests.indexOf(requestId)>=0) this.ShowRequests.splice(this.ShowRequests.indexOf(requestId),1); if(this.ShowRequests.length<=0){ this.JQueryElement.slideUp(); this.Ignore(); }}; sfFormElementBase.prototype.Show=function(requestId){ if(this.ShowRequests.indexOf(requestId)<0) this.ShowRequests.push(requestId); this.JQueryElement.slideDown(); this.UnIgnore(); }; sfFormElementBase.prototype.UnIgnore=function(){ if(this._ignore===false) return; this._ignore=false; this.FirePropertyChanged(); }; sfFormElementBase.prototype.IsIgnored=function(){ var stepOptions=this.GetStepOptions(); if(stepOptions!=null&&stepOptions.IsIgnored) return true; if(this.FieldContainer==null) return this._ignore; if(this.FieldContainer.IsIgnored()) return true; return this._ignore; }; sfFormElementBase.prototype.FirePropertyChanged=function(subField){ if(typeof subField==='undefined') subField=''; this.DestroyPopOver(); RedNaoEventManager.Publish('formPropertyChanged',{Field:this,FieldName:this.Id, Value:this.GetValueString(),FormId:this.FormId,SubField:subField}); }; sfFormElementBase.prototype.DestroyPopOver=function(){ this.JQueryElement.popover('destroy'); }; sfFormElementBase.prototype.SetDefaultIfUndefined=function(propertyName,defaultValue){ if(typeof this.Options[propertyName]=='undefined') this.Options[propertyName]=defaultValue; }; sfFormElementBase.prototype.GenerateDefaultStyle=function(){ }; sfFormElementBase.prototype.GetRootContainer=function(){ return rnJQuery("#"+this.Id); }; sfFormElementBase.prototype.GetElementByClassName=function(className){ return this.GetRootContainer().find("."+className); }; sfFormElementBase.prototype.RefreshElement=function(propertyChanged,previousValue){ if(propertyChanged!=null){ if(this.HandleRefresh(propertyChanged,previousValue)) return; } var element=this.JQueryElement; var i; var generatedElement; if(this.IsFieldContainer){ var $fieldList=element.find('.fieldContainerOfFields').detach(); var $actions=element.find('.smartFormsActionMenu').detach(); element.empty(); generatedElement=rnJQuery(this.GenerateInlineElement(propertyChanged)); if($actions.length>0) element.append($actions); element.append(generatedElement); element.find('.fieldContainerOfFields').replaceWith($fieldList); }else{ element.find(".rednao_label_container, .redNaoControls").remove(); element.find(".redNaoOneColumn").remove(); generatedElement=rnJQuery(this.GenerateInlineElement(propertyChanged)); element.append(generatedElement); } this.JQueryElement=element; this.GenerationCompleted(element); if(!smartFormsDesignMode){ } return element; }; sfFormElementBase.prototype.HandleRefresh=function(propertyChanges){ return false; }; sfFormElementBase.prototype.GenerateHtml=function(jqueryElement,animate){ var newElement=this.GetContainer().ReplaceWithJQueryElement(jqueryElement,animate); this.JQueryElement=newElement; this.GenerationCompleted(newElement); this.ApplyAllStyles(); return newElement; }; sfFormElementBase.prototype.MoveField=function(fieldToMove,position,animate){ return this.GetContainer().MoveField(this,fieldToMove,position,animate); }; sfFormElementBase.prototype.InsertField=function(fieldToInsert,position,animate){ return this.GetContainer().InsertField(this,fieldToInsert,position,animate); }; sfFormElementBase.prototype.SetContainer=function(container){ this.Container=container; this.Options.ContainerOptions.Id=container.Options.Id; this.Options.ContainerOptions.Type=container.Options.Type; }; sfFormElementBase.prototype.AppendElementToContainer=function(jqueryElement,animate){ var JQueryElement=this.GetContainer().AppendJQueryElementToUI(this,jqueryElement,animate); if(this.FieldContainer!=null&&!jqueryElement.hasClass('fieldContainerOfFields')) this.JQueryElement=JQueryElement; else{ this.JQueryElement=JQueryElement; if(this.IsFieldContainer&&this.HandleFieldsInternally) this.InitializeField(); this.GenerationCompleted(JQueryElement); this.ApplyAllStyles(); }}; sfFormElementBase.prototype.GetElementClasses=function(){ var isRequired=''; if(typeof this.Options.IsRequired!='undefined'&&this.Options.IsRequired=='y') isRequired='sfRequired'; var spacing=this.Options.Spacing; if(this.Options.ContainerOptions.Width!=-1) spacing='sfContainedField sfFieldWidth'+this.Options.ContainerOptions.Width; var fieldWithFields=''; if(this.IsFieldContainer) fieldWithFields='sfFieldWithFields'; return 'rnintid_'+this.Options._id+' rednao-control-group form-group row '+this.Options.ClassName+' '+spacing+' '+fieldWithFields+' '+ isRequired+' '+this.Options.CustomCSS; }; sfFormElementBase.prototype.GetFriendlyName=function(){ if(this.Options.Label.trim()=='') return this.Options.Id; return this.Options.Label; }; sfFormElementBase.prototype.StoresInformation=function(){ return true; }; sfFormElementBase.prototype.IsHandledByAnotherField=function(){ return this.FieldContainer!=null&&this.FieldContainer.HandleFieldsInternally; }; sfFormElementBase.prototype.CreateProperties=function(){ throw 'Abstract method'; }; sfFormElementBase.prototype.GenerateInlineElement=function(){ throw 'Abstract method'; }; sfFormElementBase.prototype.GetProperties=function(){ if(this.Properties==null){ this.Properties=[]; this.CreateProperties(); if(SmartFormsEnableGDPR=='y'&&this.StoresInformation()){ this.Properties.push(new PropertyContainer('gdpr','GDPR').AddProperties([ new CheckBoxProperty(this,this.Options,"DoNotSave","Do not save this field in the database",{ManipulatorType:'basic'}), ])); } this.CreateGlobalProperties(); } return this.Properties; }; sfFormElementBase.prototype.CreateGlobalProperties=function(){ for(var i=0;i=0) newClasses+=' SmartFormsElementSelected'; self.JQueryElement.attr('class',newClasses); }, ToolTip:{Text:"Space that the field will occupy.\r\nNote: All rows have a capacity of 12 columns and will be filled with as much fields as possible, for example, if you sequentially have two fields that use 6 columns each they will be placed in the same row", Width:'400px'}})); break; }} }; sfFormElementBase.prototype.GetPropertyName=function(){ return ''; }; sfFormElementBase.prototype.RegisterForFocusEvent=function($element){ $element.focus(function(){ $element.closest('.form-group').addClass('is-focused'); }); $element.focusout(function(){ $element.closest('.form-group').removeClass('is-focused'); }); }; sfFormElementBase.prototype.GeneratePropertiesHtml=function(jQueryObject){ var properties=this.GetProperties(); for(var i=0;i') }; sfFormElementBase.prototype.GetValueString=function(){ return ''; }; sfFormElementBase.prototype.GenerationCompleted=function(jQueryElement){ }; sfFormElementBase.prototype.IsValid=function(){ return true; }; sfFormElementBase.prototype.InternalIsValid=function(){ var firstError=this.GetFirstError(); if(firstError==null){ this.JQueryElement.removeClass('has-error'); this.JQueryElement.popover('destroy'); return true; } this.JQueryElement.addClass('has-error'); var tooltipPosition=this.ClientOptions.ToolTipPosition; if(this.ClientOptions.DocumentWidth<=768) tooltipPosition='bottom'; var trigger='click'; if(tooltipPosition=='bottom') trigger='manual'; if(tooltipPosition=='bottom'&&this.JQueryElement.data('bs.popover')!=null){ if(this.JQueryElement.data('bs.popover').$tip.find('.popover-content').text()==firstError) return; else this.DestroyPopOver(); } var container=this.JQueryElement; if(this.ClientOptions.ToolTipPosition!='none') this.JQueryElement.popover({ html:true, content :firstError, 'trigger':trigger, placement:tooltipPosition, 'container':container, template:'' }); this.JQueryElement.on('show.bs.popover',function(e,args){ if(tooltipPosition=='bottom'){ args.popoverInstance.tip().addClass('sfPopHidden'); }}); this.JQueryElement.on('shown.bs.popover',function(e,args){ if(tooltipPosition=='bottom'){ var $popover=args.popoverInstance.tip(); var height=$popover.find('.popover-content').outerHeight()+4; $popover.css('top',parseInt($popover.css('top'), 10)-5); $popover.removeClass('sfPopHidden'); $popover.addClass('in'); $popover.velocity({'height':height},"easeIn",300); }}); this.JQueryElement.on('hide.bs.popover',function(e,args){ if(tooltipPosition=='bottom'){ var $popover=args.popoverInstance.tip(); $popover.velocity({'height':0},"easeInExp",300,function(){ $popover.addClass('sfPopHidden'); $popover.removeClass('in'); }); }}); if(this.IsIgnored()) return true; this.JQueryElement.popover('show'); return false; }; sfFormElementBase.prototype.ClearInvalidStyle=function(){ }; sfFormElementBase.prototype.Clone=function(){ var newObject=rnJQuery.extend(true, {}, this); sfFormElementBase.IdCounter++; newObject.Id='rnField'+sfFormElementBase.IdCounter; newObject._id=++sfFormElementBase.FieldId; newObject.Options.Id=newObject.Id; newObject.Properties=null; newObject.Options.ContainerOptions={ Id:0, Type:'single', Width:-1 }; newObject.Container=null; return newObject; }; sfFormElementBase.prototype.GetValuePath=function(){ return ''; }; sfFormElementBase.prototype.GetDataStore=function(){ return new SmartFormBasicDataStore('value'); }; sfFormElementBase.prototype.GetLabelPath=function(){ return 'formData.'+this.Id+'.label'; }; sfFormElementBase.prototype.GetNumericalValuePath=function(){ return 'formData.'+this.Id+'.numericalValue'; }; sfFormElementBase.prototype.GetStyleTagForElement=function(elementName){ if(typeof this.StyleTags[elementName]=='undefined'){ this.StyleTags[elementName]=rnJQuery(""); rnJQuery("head").append(this.StyleTags[elementName]); } return this.StyleTags[elementName]; }; sfFormElementBase.prototype.ApplyAllStyles=function(){ for(var elements in this.Options.Styles) this.ApplyTagStyleForElement(elements); }; sfFormElementBase.prototype.ApplyTagStyleForElement=function(elementName){ if(typeof this.Options.Styles[elementName]=='undefined'||SmartFormsIsIE8OrEarlier()) return; var style=""; var elementProperties=this.Options.Styles[elementName]; if(typeof elementProperties.Properties!='undefined') for(var styleName in elementProperties.Properties){ style+=styleName+":"+elementProperties.Properties[styleName]+" !important;"; } if(typeof elementProperties.CustomCSS!='undefined') style+=elementProperties.CustomCSS.CSS; var selector=this.GetSelectorByScope(elementProperties.Scope,elementName); var tag=this.GetStyleTagForElement(elementName); tag.empty(); tag.append(selector+' {'+style+'}') }; sfFormElementBase.prototype.GetSelectorByScope=function(scope,elementName){ if(scope==SmartFormsStyleScopeField) return '#'+this.Id + " ."+elementName; if(scope==SmartFormsStyleScopeType) return '.'+this.Options.ClassName+' .'+elementName; if(scope==SmartFormsStyleScopeAll) return '.'+elementName; throw ("Undefined scope"); }; sfFormElementBase.prototype.LoadPlaceHolderIcon=function($element,$offsetLeft,$offsetRight,options){ rnJQuery.RNLoadLibrary([smartFormsPath+'js/utilities/rnPlaceHolderIcons.js'],null,function(){ SfLoadPlaceHolderIcon($element,$offsetLeft,$offsetRight,options); }); }; function sfTitleElement(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Title"; if(this.IsNew){ this.Options.ClassName="rednaotitle"; this.Options.Title="Title"; this.Options.CustomCSS=''; }else{ this.SetDefaultIfUndefined('CustomCSS',''); }} sfTitleElement.prototype=Object.create(sfFormElementBase.prototype); sfTitleElement.prototype.GetFriendlyName=function(){ return this.Options.Title; }; sfTitleElement.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Title","Title",{ManipulatorType:'basic'}), ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ ])); }; sfTitleElement.prototype.GenerateInlineElement=function(){ return '
'+RedNaoEscapeHtml(this.Options.Title)+'
'; }; sfTitleElement.prototype.GetValueString=function(){ return ''; }; sfTitleElement.prototype.StoresInformation=function(){ return false; }; function sfLineSeparator(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Title"; if(this.IsNew){ this.Options.ClassName="rednaolineseparator"; this.Options.CustomCSS=''; }else{ this.SetDefaultIfUndefined('CustomCSS',''); }} sfLineSeparator.prototype=Object.create(sfFormElementBase.prototype); sfLineSeparator.prototype.GetFriendlyName=function(){ return this.Options.Title; }; sfLineSeparator.prototype.CreateProperties=function(){ this.Properties.push(new CustomCSSProperty(this,this.Options)); }; sfLineSeparator.prototype.GenerateInlineElement=function(){ return '

'; }; sfLineSeparator.prototype.GetValueString=function(){ return ''; }; sfLineSeparator.prototype.StoresInformation=function(){ return false; }; sfLineSeparator.prototype.GenerationCompleted=function(jQueryElement){ if(this.JQueryElement.parent().hasClass('component')) this.JQueryElement.find('div').prepend('<<Horizontal Line Separator>>') }; function sfTextInputElement(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Text Input"; if(this.IsNew){ this.Options.ClassName="rednaotextinput"; this.Options.Label="Text Input"; this.Options.Placeholder=""; this.Options.Value=""; this.Options.ReadOnly='n'; this.Options.Width=""; this.Options.Icon={ClassName:''}; this.Options.CustomCSS=''; this.Options.Placeholder_Icon={ClassName:'',Orientation:''};}else{ this.SetDefaultIfUndefined('Value',''); this.SetDefaultIfUndefined('ReadOnly','n'); this.SetDefaultIfUndefined('Width',''); this.SetDefaultIfUndefined('Icon',{ClassName:''}); this.SetDefaultIfUndefined('CustomCSS',''); this.SetDefaultIfUndefined('Placeholder_Icon',{ClassName:''}); }} sfTextInputElement.prototype=Object.create(sfFormElementBase.prototype); sfTextInputElement.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','Common').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"IsRequired","Required",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"Value","Default Value",{ManipulatorType:'basic',RefreshFormData:true}).SetEnableFormula() ])); this.Properties.push(new PropertyContainer('icons','Icons and Tweaks').AddProperties([ new SimpleTextProperty(this,this.Options,"Placeholder","Placeholder",{ManipulatorType:'basic',IconOptions:{Type:'leftAndRight'}}), new SimpleNumericProperty(this,this.Options,"Width","Width",{ManipulatorType:'basic'}), new IconProperty(this,this.Options,'Icon','Icon',{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new CheckBoxProperty(this,this.Options,"ReadOnly","Read Only",{ManipulatorType:'basic'}), new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfTextInputElement.prototype.GenerateInlineElement=function(){ var additionalStyle=''; if(!isNaN(parseFloat(this.Options.Width))) additionalStyle='width:'+this.Options.Width+'px'+' !important;'; var startOfInput=''; var endOfInput=''; if(this.Options.Icon.ClassName!=''){ startOfInput='
'; endOfInput='
'; } return '
'+ '
'+ startOfInput+ ''+ endOfInput+ '
'; }; sfTextInputElement.prototype.GetValueString=function(){ if(this.IsIgnored()) return {value:''}; return {value:this.JQueryElement.find('.redNaoInputText').val()};}; sfTextInputElement.prototype.SetData=function(data){ this.JQueryElement.find('.redNaoInputText').val(data.value); }; sfTextInputElement.prototype.GetValuePath=function(){ return 'formData.'+this.Id+'.value'; }; sfTextInputElement.prototype.IsValid=function(){ if(this.JQueryElement.find('.redNaoInputText').val()==""&&this.Options.IsRequired=='y') this.AddError('root',this.InvalidInputMessage); else this.RemoveError('root'); return this.InternalIsValid(); }; sfTextInputElement.prototype.GenerationCompleted=function(jQueryElement){ var self=this; this.JQueryElement.find('.redNaoInputText').change(function(){self.FirePropertyChanged();}); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoInputText')); if(this.Options.Placeholder_Icon.ClassName!=''){ this.LoadPlaceHolderIcon(jQueryElement.find('.redNaoInputText'),null,null,this.Options.Placeholder_Icon); }}; function sfPrependTexElement(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Prepend Text"; if(this.IsNew){ this.Options.Label="Prepend Text"; this.Options.ClassName="rednaoprependedtext"; this.Options.Placeholder=""; this.Options.Prepend="Prepend"; this.Options.Value=''; this.Options.Checked='y'; this.Options.Width=''; this.Options.Icon={ClassName:''}; this.Options.CustomCSS=''; this.Options.ReadOnly='n'; this.Options.Placeholder_Icon={ClassName:'',Orientation:''};}else{ this.SetDefaultIfUndefined('Value',''); this.SetDefaultIfUndefined('Width',''); this.SetDefaultIfUndefined('Icon',{ClassName:''}); this.SetDefaultIfUndefined('CustomCSS',''); this.SetDefaultIfUndefined('Placeholder_Icon',{ClassName:''}); this.SetDefaultIfUndefined('ReadOnly','n'); }} sfPrependTexElement.prototype=Object.create(sfFormElementBase.prototype); sfPrependTexElement.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"IsRequired","Required",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"Prepend","Prepend Text",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"Value","Default Value",{ManipulatorType:'basic',RefreshFormData:true}).SetEnableFormula() ])); this.Properties.push(new PropertyContainer('icons','Icons and Tweaks').AddProperties([ new SimpleTextProperty(this,this.Options,"Placeholder","Placeholder",{ManipulatorType:'basic',IconOptions:{Type:'leftAndRight'}}), new SimpleNumericProperty(this,this.Options,"Width","Width",{ManipulatorType:'basic'}), new IconProperty(this,this.Options,'Icon','Icon',{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new CheckBoxProperty(this,this.Options,"ReadOnly","Read Only",{ManipulatorType:'basic'}), new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfPrependTexElement.prototype.GenerateInlineElement=function(){ var additionalStyle=''; if(!isNaN(parseFloat(this.Options.Width))) additionalStyle='width:'+this.Options.Width+'px'+' !important;'; return '
'+ '' + '
'+ '
'+ '
'+ (this.Options.Icon.ClassName!=''?'' :''+RedNaoEscapeHtml(this.Options.Prepend)+'')+ ''+ '
'+ '
'; }; sfPrependTexElement.prototype.GetValueString=function(){ if(this.IsIgnored()) return {value:''}; return {value:this.JQueryElement.find('.redNaoInputText').val()};}; sfPrependTexElement.prototype.SetData=function(data){ this.JQueryElement.find('.redNaoInputText').val(data.value); }; sfPrependTexElement.prototype.GetValuePath=function(){ return 'formData.'+this.Id+'.value'; }; sfPrependTexElement.prototype.IsValid=function(){ if(this.JQueryElement.find('.redNaoInputText').val()==""&&this.Options.IsRequired=='y'){ this.JQueryElement.addClass('has-error'); this.AddError('root',this.InvalidInputMessage); } else this.RemoveError('root'); return this.InternalIsValid(); }; sfPrependTexElement.prototype.GenerationCompleted=function(jQueryElement){ var self=this; this.JQueryElement.find('.redNaoInputText').change(function(){self.FirePropertyChanged();}); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoInputText')); if(this.Options.Placeholder_Icon.ClassName!=''){ this.LoadPlaceHolderIcon(jQueryElement.find('.redNaoInputText'),jQueryElement.find('.redNaoPrepend'),null,this.Options.Placeholder_Icon); }}; function sfAppendedTexElement(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Appended Text"; if(this.IsNew){ this.Options.Label="Appended Text"; this.Options.ClassName="rednaoappendedtext"; this.Options.Placeholder=""; this.Options.Append="Append"; this.Options.Value=""; this.Options.Width=''; this.Options.Icon={ClassName:''}; this.Options.CustomCSS=''; this.Options.ReadOnly='n'; this.Options.Placeholder_Icon={ClassName:'',Orientation:''};}else{ this.SetDefaultIfUndefined('Value',''); this.SetDefaultIfUndefined('Width',''); this.SetDefaultIfUndefined('Icon',{ClassName:""}); this.SetDefaultIfUndefined('CustomCSS',''); this.SetDefaultIfUndefined('Placeholder_Icon',{ClassName:''}); this.SetDefaultIfUndefined('ReadOnly','n'); }} sfAppendedTexElement.prototype=Object.create(sfFormElementBase.prototype); sfAppendedTexElement.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"IsRequired","Required",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"Append","Append Text",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"Value","Default Value",{ManipulatorType:'basic',RefreshFormData:true}).SetEnableFormula() ])); this.Properties.push(new PropertyContainer('icons','Icons and Tweaks').AddProperties([ new SimpleTextProperty(this,this.Options,"Placeholder","Placeholder",{ManipulatorType:'basic',IconOptions:{Type:'leftAndRight'}}), new SimpleNumericProperty(this,this.Options,"Width","Width",{ManipulatorType:'basic'}), new IconProperty(this,this.Options,'Icon','Icon',{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new CheckBoxProperty(this,this.Options,"ReadOnly","Read Only",{ManipulatorType:'basic'}), new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfAppendedTexElement.prototype.GenerateInlineElement=function(){ var additionalStyle=''; if(!isNaN(parseFloat(this.Options.Width))) additionalStyle='width:'+this.Options.Width+'px'+' !important;'; return '
'+ '
'+ '
'+ ''+ (this.Options.Icon.ClassName!=''?'' :''+RedNaoEscapeHtml(this.Options.Append)+'')+ '
'+ '
'; }; sfAppendedTexElement.prototype.GetValueString=function(){ if(this.IsIgnored()) return {value:''}; return {value:this.JQueryElement.find('.redNaoInputText').val()};}; sfAppendedTexElement.prototype.SetData=function(data){ this.JQueryElement.find('.redNaoInputText').val(data.value); }; sfAppendedTexElement.prototype.GetValuePath=function(){ return 'formData.'+this.Id+'.value'; }; sfAppendedTexElement.prototype.IsValid=function(){ if(this.JQueryElement.find('.redNaoInputText').val()==""&&this.Options.IsRequired=='y'){ this.JQueryElement.addClass('has-error'); this.AddError('root',this.InvalidInputMessage); }else this.RemoveError('root'); return this.InternalIsValid(); }; sfAppendedTexElement.prototype.GenerationCompleted=function(jQueryElement){ var self=this; this.JQueryElement.find('.redNaoInputText').change(function(){self.FirePropertyChanged();}); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoInputText')); if(this.Options.Placeholder_Icon.ClassName!=''){ this.LoadPlaceHolderIcon(jQueryElement.find('.redNaoInputText'),null,jQueryElement.find('.redNaoAppend'),this.Options.Placeholder_Icon); }}; function sfPrependCheckBoxElement(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Prepend Checkbox"; if(this.IsNew){ this.Options.Label="Prepend Checkbox"; this.Options.ClassName="rednaoprependedcheckbox"; this.Options.Placeholder=""; this.Options.IsChecked='n'; this.Options.Value=""; this.Options.Width=''; this.Options.CustomCSS=''; this.Options.Placeholder_Icon={ClassName:'',Orientation:''};}else{ this.SetDefaultIfUndefined('Value',''); this.SetDefaultIfUndefined('Width',''); this.SetDefaultIfUndefined('CustomCSS',''); this.SetDefaultIfUndefined('Placeholder_Icon',{ClassName:''}); }} sfPrependCheckBoxElement.prototype=Object.create(sfFormElementBase.prototype); sfPrependCheckBoxElement.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"IsRequired","Required",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"Value","Default Value",{ManipulatorType:'basic',RefreshFormData:true}).SetEnableFormula() ])); this.Properties.push(new PropertyContainer('icons','Icons and Tweaks').AddProperties([ new SimpleTextProperty(this,this.Options,"Placeholder","Placeholder",{ManipulatorType:'basic',IconOptions:{Type:'leftAndRight'}}), new SimpleNumericProperty(this,this.Options,"Width","Width",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"IsChecked","Is Checked",{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfPrependCheckBoxElement.prototype.GenerateInlineElement=function(){ var additionalStyle=''; if(!isNaN(parseFloat(this.Options.Width))) additionalStyle='width:'+this.Options.Width+'px'+' !important;'; return '
\
\
\ \ \ \ \
\
'; }; sfPrependCheckBoxElement.prototype.GetValueString=function(){ if(this.IsIgnored()) return {checked:'n',value:''}; return {checked:(this.JQueryElement.find('.redNaoRealCheckBox').is(':checked')?'Yes':'No'),value:this.JQueryElement.find('.redNaoInputText').val()};}; sfPrependCheckBoxElement.prototype.SetData=function(data){ if(data.checked=='Yes') this.JQueryElement.find('.redNaoRealCheckBox').attr('checked','checked'); else this.JQueryElement.find('.redNaoRealCheckBox').removeAttr('checked'); this.JQueryElement.find('.redNaoInputText').val(data.value); }; sfPrependCheckBoxElement.prototype.GetValuePath=function(){ return 'formData.'+this.Id+'.value'; }; sfPrependCheckBoxElement.prototype.IsValid=function(){ if(this.JQueryElement.find('.redNaoInputText').val()==""&&this.Options.IsRequired=='y'){ this.JQueryElement.addClass('has-error'); this.AddError('root',this.InvalidInputMessage); }else this.RemoveError('root'); return this.InternalIsValid(); }; sfPrependCheckBoxElement.prototype.GenerationCompleted=function(jQueryElement){ var self=this; this.JQueryElement.find('.redNaoInputText,.redNaoRealCheckBox').change(function(){self.FirePropertyChanged();}); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoInputText')); if(this.Options.Placeholder_Icon.ClassName!=''){ this.LoadPlaceHolderIcon(jQueryElement.find('.redNaoInputText'),jQueryElement.find('.redNaoPrepend'),null,this.Options.Placeholder_Icon); }}; function sfAppendCheckBoxElement(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Append Checkbox"; if(this.IsNew){ this.Options.Label="Append Checkbox"; this.Options.ClassName="rednaoappendedcheckbox"; this.Options.Placeholder=""; this.Options.IsChecked='n'; this.Options.Value=""; this.Options.Width=''; this.Options.CustomCSS=''; this.Options.Placeholder_Icon={ClassName:'',Orientation:''};}else{ this.SetDefaultIfUndefined('Value',''); this.SetDefaultIfUndefined('Width',''); this.SetDefaultIfUndefined('CustomCSS',''); this.SetDefaultIfUndefined('Placeholder_Icon',{ClassName:''}); }} sfAppendCheckBoxElement.prototype=Object.create(sfFormElementBase.prototype); sfAppendCheckBoxElement.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"IsRequired","Required",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"Value","Default Value",{ManipulatorType:'basic',RefreshFormData:true}).SetEnableFormula() ])); this.Properties.push(new PropertyContainer('icons','Icons and Tweaks').AddProperties([ new SimpleTextProperty(this,this.Options,"Placeholder","Placeholder",{ManipulatorType:'basic',IconOptions:{Type:'leftAndRight'}}), new SimpleNumericProperty(this,this.Options,"Width","Width",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"IsChecked","Is Checked",{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfAppendCheckBoxElement.prototype.GenerateInlineElement=function(){ var additionalStyle=''; if(!isNaN(parseFloat(this.Options.Width))) additionalStyle='width:'+this.Options.Width+'px'+' !important;'; return '
\
\
\ \ \ \ \
\
'; }; sfAppendCheckBoxElement.prototype.GetValueString=function(){ if(this.IsIgnored()) return {checked:'n',value:''}; return {checked:(this.JQueryElement.find('.redNaoRealCheckBox').is(':checked')?'Yes':'No'),value:this.JQueryElement.find('.redNaoInputText').val()};}; sfAppendCheckBoxElement.prototype.SetData=function(data){ if(data.checked=='Yes') this.JQueryElement.find('.redNaoRealCheckBox').attr('checked','checked'); else this.JQueryElement.find('.redNaoRealCheckBox').removeAttr('checked'); this.JQueryElement.find('.redNaoInputText').val(data.value); }; sfAppendCheckBoxElement.prototype.GetValuePath=function(){ return 'formData.'+this.Id+'.value'; }; sfAppendCheckBoxElement.prototype.IsValid=function(){ if(this.JQueryElement.find('.redNaoInputText').val()==""&&this.Options.IsRequired=='y'){ this.JQueryElement.addClass('has-error'); this.AddError('root',this.InvalidInputMessage); } else this.RemoveError('root'); return this.InternalIsValid(); }; sfAppendCheckBoxElement.prototype.GenerationCompleted=function(jQueryElement){ var self=this; this.JQueryElement.find('.redNaoInputText,.redNaoRealCheckBox').change(function(){self.FirePropertyChanged();}); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoInputText')); if(this.Options.Placeholder_Icon.ClassName!=''){ this.LoadPlaceHolderIcon(jQueryElement.find('.redNaoInputText'),null,jQueryElement.find('.redNaoAppend'),this.Options.Placeholder_Icon); }}; function sfTextAreaElement(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Text Area"; if(this.IsNew){ this.Options.Label="Text Area"; this.Options.DefaultText=""; this.Options.ClassName="rednaotextarea"; this.Options.Value=""; this.Options.Width=''; this.Options.Height=''; this.Options.Placeholder=''; this.Options.Disabled="n"; this.Options.MaxLength=''; this.Options.CustomCSS=''; this.Options.Placeholder_Icon={ClassName:'',Orientation:''};}else{ this.SetDefaultIfUndefined('Value',''); this.SetDefaultIfUndefined('Width',''); this.SetDefaultIfUndefined('Height',''); this.SetDefaultIfUndefined('Placeholder',''); this.SetDefaultIfUndefined('Disabled','n'); this.SetDefaultIfUndefined('MaxLength',''); this.SetDefaultIfUndefined('CustomCSS',''); this.SetDefaultIfUndefined('Placeholder_Icon',{ClassName:''}); } this.MaxLength=parseFloat(this.Options.MaxLength); } sfTextAreaElement.prototype=Object.create(sfFormElementBase.prototype); sfTextAreaElement.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"DefaultText","Default Value",{ManipulatorType:'basic',RefreshFormData:true,MultipleLine:true}).SetEnableFormula(), new CheckBoxProperty(this,this.Options,"IsRequired","Required",{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('icons','Icons and Tweaks').AddProperties([ new SimpleTextProperty(this,this.Options,"Placeholder","Placeholder",{ManipulatorType:'basic',RefreshFormData:true,IconOptions:{Type:'leftAndRight'}}), new SimpleNumericProperty(this,this.Options,"MaxLength","Max Length",{ManipulatorType:'basic',Placeholder:"No Limit"}), new SimpleNumericProperty(this,this.Options,"Width","Width",{ManipulatorType:'basic'}), new SimpleNumericProperty(this,this.Options,"Height","Height",{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new CheckBoxProperty(this,this.Options,"Disabled","Read Only",{ManipulatorType:'basic'}), new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfTextAreaElement.prototype.GenerateInlineElement=function(){ var additionalStyle=''; if(!isNaN(parseFloat(this.Options.Width))) additionalStyle='width:'+this.Options.Width+'px'+' !important;'; if(!isNaN(parseFloat(this.Options.Height))) additionalStyle+='height:'+this.Options.Height+'px'+' !important;'; var disabled=""; if(this.Options.Disabled=='y') disabled='disabled="disabled"'; var html='
\
\ '; if(!isNaN(this.MaxLength)) html+=''+this.MaxLength.toString()+''; html+='
'; return html; }; sfTextAreaElement.prototype.GetValueString=function(){ if(this.IsIgnored()) return {value:''}; return {value:this.JQueryElement.find('.redNaoTextAreaInput').val()};}; sfTextAreaElement.prototype.SetData=function(data){ this.JQueryElement.find('.redNaoTextAreaInput').val(data.value); }; sfTextAreaElement.prototype.GetValuePath=function(){ return 'formData.'+this.Id+'.value'; }; sfTextAreaElement.prototype.IsValid=function(){ if(this.JQueryElement.find('.redNaoTextAreaInput').val()==""&&this.Options.IsRequired=='y'){ this.JQueryElement.addClass('has-error'); this.AddError('root',this.InvalidInputMessage); } else this.RemoveError('root'); return this.InternalIsValid(); }; sfTextAreaElement.prototype.GenerationCompleted=function(jQueryElement){ var self=this; this.JQueryElement.find('.redNaoTextAreaInput').change(function(){self.FirePropertyChanged();}); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoTextAreaInput')); if(!isNaN(this.MaxLength)) this.JQueryElement.find(' .redNaoTextAreaInput').bind('keyup keydown',function(){ var length=rnJQuery(this).val().length; var charactersRemaining=self.MaxLength-length; var wordCounter=self.GetElementByClassName('smartFormsCharacterCount'); wordCounter.text(charactersRemaining.toString()); if(charactersRemaining<=20) wordCounter.addClass("smartFormsAlmostFull"); else wordCounter.removeClass("smartFormsAlmostFull"); }); if(this.Options.Placeholder_Icon.ClassName!=''){ this.LoadPlaceHolderIcon(jQueryElement.find('.redNaoTextAreaInput'),null,null,this.Options.Placeholder_Icon); }}; function sfMultipleRadioElement(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Multiple Radio"; var i=undefined; if(this.IsNew){ this.Options.Label="Multiple Radio"; this.Options.ClassName="rednaomultipleradios"; this.Options.Orientation='v'; this.Options.Options=[{label:'Option 1',value:0,sel:'n'},{label:'Option 2',value:0,sel:'n'},{label:'Option 3',value:0,sel:'n'}]; this.Options.CustomCSS=''; }else{ this.SetDefaultIfUndefined('CustomCSS',''); if(RedNaoGetValueOrNull(this.Options.Orientation)==null) this.Options.Orientation='v'; if(this.Options.Options.length>0&&typeof this.Options.Options[0].sel=='undefined'){ this.Options.Options[0].sel='y'; for(i=1;i0&&typeof this.Options.Options[i]=='string'){ var aux=[]; for(i=0;i\
'; var checked=''; for(var i=0;i\ \
'; checked=""; } html+=''; return html; }; sfMultipleRadioElement.prototype.GetValueString=function(){ if(this.IsIgnored()){ this.amount=0; return {value:'',amount:0};} var jQueryElement=this.JQueryElement.find(':checked'); if(jQueryElement.length>0) this.amount=parseFloat(jQueryElement.val()); else this.amount=0; if(isNaN(this.amount)) this.amount=0; return {value:rnJQuery.trim(jQueryElement.parent().find('label').text()),amount:this.amount};}; sfMultipleRadioElement.prototype.SetData=function(data){ if(data.value!=''){ var labels=this.JQueryElement.find('.redNaoRadio'); for(var i=0;i0&&typeof this.Options.Options[0].sel=='undefined'){ for(i=0;i0&&typeof this.Options.Options[i]=='string'){ var aux=[]; for(i=0;i'; html+='
'; var checked=''; for(var i=0;i\ \
'; checked=""; } html+=''; return html; }; sfMultipleCheckBoxElement.prototype.GetValueString=function(){ this.amount=0; if(this.IsIgnored()) return {selectedValues:[]}; var jQueryElement=this.JQueryElement.find(':checked'); var data={}; data.selectedValues=[]; if(jQueryElement.length>0){ for(var i=0;i0) this.amount=parseFloat(rnJQuery(jQueryElement[i]).val()); if(isNaN(this.amount)) this.amount=0; data.selectedValues.push({value:rnJQuery.trim(rnJQuery(jQueryElement[i]).parent().find('label').text()),amount:this.amount,label:rnJQuery.trim(rnJQuery(jQueryElement[i]).parent().find('label').text())}); }} return data; }; sfMultipleCheckBoxElement.prototype.SetData=function(data){ if(typeof data.selectedValues=='undefined') return; this.JQueryElement.find('input:checkbox').removeAttr('checked'); var labels=this.JQueryElement.find('.redNaoCheckBox'); for(var i=0;i0&&typeof this.Options.Options[0].sel=='undefined'){ this.Options.Options[0].sel='y'; for(i=1;i0&&typeof this.Options.Options[i]=='string'){ var aux=[]; for(i=0;i\
\
'; return html; }; sfSelectBasicElement.prototype.GetValueString=function(){ if(this.IsIgnored()){ this.amount=0; return {value:'',amount:0};} var jQueryElement=this.JQueryElement.find('.redNaoSelect option:selected'); if(jQueryElement.length>0) this.amount=parseFloat(jQueryElement.val()); if(isNaN(this.amount)) this.amount=0; if(jQueryElement.text()==this.Options.DefaultText){ this.amount=0; return {value:'',amount:0};} return {value:jQueryElement.text(),amount:this.amount,optionVal:jQueryElement.val()};}; sfSelectBasicElement.prototype.SetData=function(data){ var options=this.JQueryElement.find('option'); for(var i=0;i'+ '
' + '' + '
'; }; sfDonationButtonElement.prototype.GetValueString=function(){ return ''; }; sfDonationButtonElement.prototype.StoresInformation=function(){ return false; }; function sfRecurrenceElement(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Donation Button"; if(this.IsNew){ this.Options.Label="Recurrence"; this.Options.ClassName="rednaodonationrecurrence"; this.Options.ShowOneTime='y'; this.Options.ShowDaily='y'; this.Options.ShowWeekly='y'; this.Options.ShowMonthly='y'; this.Options.ShowYearly='y'; this.Options.CustomCSS=''; }else{ this.SetDefaultIfUndefined('CustomCSS',''); }} sfRecurrenceElement.prototype=Object.create(sfFormElementBase.prototype); sfRecurrenceElement.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('icons','Icons and Tweaks').AddProperties([ new CheckBoxProperty(this,this.Options,"ShowOneTime","Show one time option",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"ShowDaily","Show daily option",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"ShowWeekly","Show weekly option",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"ShowMonthly","Show monthly option",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"ShowYearly","Show yearly option",{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfRecurrenceElement.prototype.GenerateInlineElement=function(){ var html='
' + '' + '
' + '
' + '
'; return html; }; sfRecurrenceElement.prototype.GetValueString=function(){ if(this.IsIgnored()) return {value:''}; var jQueryElement=this.JQueryElement.find('.redNaoSelect option:selected'); return {value:jQueryElement.val()};}; sfRecurrenceElement.prototype.SetData=function(data){ this.JQueryElement.find('.redNaoSelect').val(data.value); }; sfRecurrenceElement.prototype.GetValuePath=function(){ return 'formData.'+this.Id+'.value'; }; sfRecurrenceElement.prototype.GenerationCompleted=function(jQueryElement){ var self=this; this.JQueryElement.find('.redNaoSelect').change(function(){self.FirePropertyChanged();}); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoSelect')); }; function sfRedNaoSubmissionButton(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Submit Button"; if(this.IsNew){ this.Options.ClassName="rednaosubmissionbutton"; this.Options.ButtonText="Submit"; this.Options.CustomCSS=''; this.Options.Icon={ClassName:''}; this.Options.Animated='y'; }else{ this.SetDefaultIfUndefined('CustomCSS',''); this.SetDefaultIfUndefined('Icon',{ClassName:''}); this.SetDefaultIfUndefined('Animated','n'); } this.RegisterForSubmitEvents(); } sfRedNaoSubmissionButton.prototype=Object.create(sfFormElementBase.prototype); sfRedNaoSubmissionButton.prototype.RegisterForSubmitEvents=function(){ var self=this; RedNaoEventManager.Subscribe('FormSubmitted',function(data){ if(data.Generator.form_id!=self.FormId) return; if(self.Options.Animated=='y') self.JQueryElement.find('button').RNWait('start'); else self.JQueryElement.find('button').attr('disabled','disabled'); }); RedNaoEventManager.Subscribe('FormSubmittedCompleted',function(data){ if(data.Generator.form_id!=self.FormId) return; if(self.Options.Animated=='y') self.JQueryElement.find('button').RNWait('stop'); else self.JQueryElement.find('button').removeAttr('disabled','disabled'); }); }; sfRedNaoSubmissionButton.prototype.GetFriendlyName=function(){ return this.Options.ButtonText; }; sfRedNaoSubmissionButton.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"ButtonText","Button Text",{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('icons','Icons and Tweaks').AddProperties([ new IconProperty(this,this.Options,'Icon','Icon',{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"Animated","Animate Button Click",{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfRedNaoSubmissionButton.prototype.GenerateInlineElement=function(){ var icon=''; if(this.Options.Icon.ClassName!='') icon=''; return '
'; }; sfRedNaoSubmissionButton.prototype.GetValueString=function(){ return ''; }; sfRedNaoSubmissionButton.prototype.StoresInformation=function(){ return false; }; function sfRedNaoDatePicker(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Date Picker"; if(this.IsNew){ this.Options.ClassName="rednaodatepicker"; this.Options.Label="Date"; this.Options.DateFormat="MM-dd-yy"; this.Options.Value=''; this.Options.Icon={ClassName:''}; this.Options.ReadOnly='n'; this.Options.Value=''; this.Options.CustomCSS=''; this.Options.IsRequired='n'; this.Options.ShowMonthPicker='n'; this.Options.ShowYearPicker='n'; this.Options.Placeholder=""; this.Options.Placeholder_Icon={ClassName:'',Orientation:''}; this.Options.MaximumDate=''; this.Options.MinimumDate=''; }else{ this.SetDefaultIfUndefined('Icon',{ClassName:''}); this.SetDefaultIfUndefined('ReadOnly','n'); this.SetDefaultIfUndefined('Value',''); this.SetDefaultIfUndefined('CustomCSS',''); this.SetDefaultIfUndefined('IsRequired','n'); this.SetDefaultIfUndefined('ShowMonthPicker','n'); this.SetDefaultIfUndefined('ShowYearPicker','n'); this.SetDefaultIfUndefined('Placeholder',''); this.SetDefaultIfUndefined('Placeholder_Icon',{ClassName:''}); this.SetDefaultIfUndefined('MaximumDate',''); this.SetDefaultIfUndefined('MinimumDate',''); }} sfRedNaoDatePicker.prototype=Object.create(sfFormElementBase.prototype); sfRedNaoDatePicker.prototype.GetDataStore=function(){ return new SmartFormDateDataStore('value'); }; sfRedNaoDatePicker.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"IsRequired","Required",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"Value","Default Value",{ManipulatorType:'basic',RefreshFormData:true}).SetEnableFormula() ])); this.Properties.push(new PropertyContainer('icons','Icons and Tweaks').AddProperties([ new SimpleTextProperty(this,this.Options,"Placeholder","Placeholder",{ManipulatorType:'basic',IconOptions:{Type:'leftAndRight'}}), new SimpleTextProperty(this,this.Options,"DateFormat","Date Format",{ManipulatorType:'basic'}), new DatePickerProperty(this,this.Options,"MinimumDate","Minimum Date",{ManipulatorType:'basic',RefreshFormData:true}).SetEnableFormula().SetAllowRelativeDates(), new DatePickerProperty(this,this.Options,"MaximumDate","Maximum Date",{ManipulatorType:'basic',RefreshFormData:true}).SetEnableFormula().SetAllowRelativeDates(), new CheckBoxProperty(this,this.Options,"ShowMonthPicker","Show Month Picker",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"ShowYearPicker","Show Year Picker",{ManipulatorType:'basic'}), new IconProperty(this,this.Options,'Icon','Icon',{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new CheckBoxProperty(this,this.Options,"ReadOnly","Read Only",{ManipulatorType:'basic'}), new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfRedNaoDatePicker.prototype.GenerateInlineElement=function(){ var startOfInput=''; var endOfInput=''; if(this.Options.Icon.ClassName!=''){ startOfInput='
'; endOfInput='
'; } return '
' + '' + '
' + '
' + startOfInput+ '' + endOfInput+ '
'; }; sfRedNaoDatePicker.prototype.GetValueString=function(){ if(this.IsIgnored()) return {value:'',formattedValue:''}; var selectedDate=this.JQueryElement.find('.redNaoDatePicker').datepicker('getDate'); var dateLabel=''; var numericalValues=0; if(selectedDate==null) selectedDate=""; else { numericalValues=selectedDate.getTime(); var month=selectedDate.getMonth()+1; var day=selectedDate.getDate(); selectedDate=selectedDate.getFullYear()+'-'+(month<10?'0':'')+month+'-'+(day<10?'0':'')+day; dateLabel=this.JQueryElement.find('.redNaoDatePicker').datepicker({dateFormat: this.Options.DateFormat}).val(); } return {value:selectedDate,formattedValue:dateLabel,format: this.Options.DateFormat,numericalValue:numericalValues};}; sfRedNaoDatePicker.prototype.SetData=function(data){ this.JQueryElement.find('.redNaoDatePicker').datepicker('setDate',data.formattedValue); }; sfRedNaoDatePicker.prototype.GetValuePath=function(){ return 'formData.'+this.Id+'.value'; }; sfRedNaoDatePicker.prototype.StoresInformation=function(){ return true; }; sfRedNaoDatePicker.prototype.GenerationCompleted=function(jQueryElement){ var minDate=this.ParseDate(this.Options.MinimumDate); var maxDate=this.ParseDate(this.Options.MaximumDate); var self=this; var datePickerOptions={ dateFormat:this.Options.DateFormat, beforeShow: function(){ rnJQuery('#ui-datepicker-div').wrap('
'); self.JQueryElement.addClass('is-focused'); }, onClose: function(){ rnJQuery('#ui-datepicker-div').unwrap(); self.JQueryElement.removeClass('is-focused'); }, changeMonth:self.Options.ShowMonthPicker=="y", changeYear:self.Options.ShowYearPicker=="y" }; if(minDate!=null) datePickerOptions.minDate=minDate; if(maxDate!=null) datePickerOptions.maxDate=maxDate; datePickerOptions.yearRange='-100:+100'; this.JQueryElement.find('.redNaoDatePicker').datepicker(datePickerOptions); rnJQuery('#ui-datepicker-div').css('display','none'); if(this.Options.Value instanceof Date||rnJQuery.trim(this.Options.Value)!='') this.JQueryElement.find('.redNaoDatePicker').datepicker('setDate',this.Options.Value); if(this.Options.ReadOnly=='y') this.JQueryElement.find('.redNaoDatePicker').datepicker('disable'); var self=this; this.JQueryElement.change(function(){self.FirePropertyChanged();}); if(this.Options.Placeholder_Icon.ClassName!=''){ this.LoadPlaceHolderIcon(jQueryElement.find('.redNaoDatePicker'),null,null,this.Options.Placeholder_Icon); }}; sfRedNaoDatePicker.prototype.ParseDate=function(date){ var dateToReturn=date; if(date instanceof SmartFormDateDataStore) dateToReturn=date.GetTime(); if(dateToReturn=='0'||dateToReturn=='') return null; if(!isNaN(Number(dateToReturn))&&((date instanceof SmartFormDateDataStore)||parseInt(dateToReturn)>100000000)) return new Date(Number(dateToReturn)); return dateToReturn; }; sfRedNaoDatePicker.prototype.IsValid=function(){ var selectedDate=this.JQueryElement.find('.redNaoDatePicker').datepicker('getDate'); if(selectedDate==null&&this.Options.IsRequired=='y') this.AddError('root',this.InvalidInputMessage); else this.RemoveError('root'); return this.InternalIsValid(); }; function sfRedNaoName(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Text Input"; if(this.IsNew){ this.Options.ClassName="rednaoname"; this.Options.Label="Name"; this.Options.FirstNamePlaceholder="First Name"; this.Options.LastNamePlaceholder="Last Name"; this.Options.FirstNameValue=""; this.Options.LastNameValue=""; this.Options.ReadOnly='n'; this.Options.Icon={ClassName:''}; this.Options.CustomCSS=''; this.Options.IsRequired='n'; this.Options.FirstNamePlaceholder_Icon={ClassName:'',Orientation:''};}else{ this.SetDefaultIfUndefined('Icon',{ClassName:''}); this.SetDefaultIfUndefined('CustomCSS',''); this.SetDefaultIfUndefined('IsRequired','n'); this.SetDefaultIfUndefined('IsRequired','n'); this.SetDefaultIfUndefined('FirstNamePlaceholder_Icon',{ClassName:''}); }} sfRedNaoName.prototype=Object.create(sfFormElementBase.prototype); sfRedNaoName.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"IsRequired","Required",{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('icons','Icons and Tweaks').AddProperties([ new SimpleTextProperty(this,this.Options,"FirstNamePlaceholder","First name placeholder",{ManipulatorType:'basic',IconOptions:{Type:'leftAndRight'}}), new SimpleTextProperty(this,this.Options,"LastNamePlaceholder","Last name placeholder",{ManipulatorType:'basic'}), new IconProperty(this,this.Options,'Icon','Icon',{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new CheckBoxProperty(this,this.Options,"ReadOnly","Read Only",{ManipulatorType:'basic'}), new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfRedNaoName.prototype.GenerateInlineElement=function(){ var startOfInput=''; var endOfInput=''; if(this.Options.Icon.ClassName!=''){ startOfInput='
'; endOfInput='
'; } var firstNameLabel=''; var lastNameLabel=''; if(this.Options.FirstNamePlaceholder!='') firstNameLabel='
'; if(this.Options.LastNamePlaceholder!='') lastNameLabel='
'; return '
'+ '
'+ '
'+ '
'+ startOfInput+ ''+ endOfInput+ '
'+ '
'+ ''+ '
'+ '
'+ '
'+ '
'; }; sfRedNaoName.prototype.GetValueString=function(){ if(this.IsIgnored()) return {firstName:'',lastName:''}; return { firstName:this.JQueryElement.find('.redNaoInputFirstName').val(), lastName:this.JQueryElement.find('.redNaoInputLastName').val() };}; sfRedNaoName.prototype.SetData=function(data){ this.JQueryElement.find('.redNaoInputFirstName').val(data.firstName); this.JQueryElement.find('.redNaoInputLastName').val(data.lastName); }; sfRedNaoName.prototype.GetValuePath=function(){ return 'formData.'+this.Id+'.firstName+" "'+'formData.'+this.Id+'.lastName'; }; sfRedNaoName.prototype.IsValid=function(){ if(this.Options.IsRequired=='y'&&(this.JQueryElement.find('.redNaoInputFirstName').val()==""||this.JQueryElement.find('.redNaoInputLastName').val()=="")){ var firstNameJQuery=this.JQueryElement.find('.redNaoInputFirstName'); var lastNameJQuery=this.JQueryElement.find('.redNaoInputLastName'); if(firstNameJQuery.val()=="") firstNameJQuery.parent().addClass('has-error'); if(lastNameJQuery.val()=="") lastNameJQuery.parent().addClass('has-error'); this.AddError('root',this.InvalidInputMessage); } else this.RemoveError('root'); return this.InternalIsValid(); }; sfRedNaoName.prototype.GenerationCompleted=function(jQueryElement){ var self=this; this.JQueryElement.find('.redNaoInputFirstName,.redNaoInputLastName').change(function(){self.FirePropertyChanged();}); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoInputFirstName')); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoInputLastName')); if(this.Options.FirstNamePlaceholder_Icon.ClassName!=''){ this.LoadPlaceHolderIcon(jQueryElement.find('.redNaoInputFirstName'),null,null,this.Options.FirstNamePlaceholder_Icon); }}; function sfRedNaoAddress(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Text Input"; this.Countries=["Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria", "Burkina Faso", "Burma", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Central African Republic", "Chad", "Chile", "China", "Colombia", "Comoros", "Congo, Democratic Republic", "Congo, Republic of the", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Fiji", "Finland", "France", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Greece", "Greenland", "Grenada", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, North", "Korea, South", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Mongolia", "Morocco", "Monaco", "Mozambique", "Namibia", "Nauru", "Nepal", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway", "Oman", "Pakistan", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal", "Qatar", "Romania", "Russia", "Rwanda", "Samoa", "San Marino", " Sao Tome", "Saudi Arabia", "Senegal", "Serbia","Montenegro", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland", "Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Vietnam", "Yemen", "Zambia", "Zimbabwe"]; if(this.IsNew){ this.Options.ClassName="rednaoaddress"; this.Options.Label="Address"; this.Options.StreetAddress1Label="Street Address"; this.Options.StreetAddress2Label="Street Address 2"; this.Options.CityLabel="City"; this.Options.StateLabel="State"; this.Options.ZipLabel='Zip'; this.Options.CountryLabel='Country'; this.Options.DefaultCountry="United States"; this.Options.ShowStreetAddress1="y"; this.Options.ShowStreetAddress2="y"; this.Options.ShowCity="y"; this.Options.ShowState="y"; this.Options.ShowZip='y'; this.Options.ShowCountry='y'; this.Options.Icon={ClassName:''}; this.Options.CustomCSS=''; }else{ this.SetDefaultIfUndefined("DefaultCountry","United States"); this.SetDefaultIfUndefined('Icon',{ClassName:''}); this.SetDefaultIfUndefined('CustomCSS',''); }} sfRedNaoAddress.prototype=Object.create(sfFormElementBase.prototype); sfRedNaoAddress.prototype.GetCountriesForPropertyConfiguration=function (){ var countriesToReturn=new Array(this.Countries.length); for(var i=0;i'; endOfInput='
'; } if(this.Options.StreetAddress1Label!='') StreetAddress1Label=''; if(this.Options.StreetAddress2Label!='') StreetAddress2Label=''; if(this.Options.CityLabel!='') CityLabel='
'; if(this.Options.StateLabel!='') StateLabel='
'; if(this.Options.ZipLabel!='') ZipLabel='
'; if(this.Options.CountryLabel!='') CountryLabel='
'; var html='
\
'; if(this.Options.ShowStreetAddress1=='y') html+='
'+ startOfInput+''+endOfInput+ '
'; if(this.Options.ShowStreetAddress2=='y') html+='
\ '+ '
'; html+="
"; if(this.Options.ShowCity=='y') html+='
\ '+ '
'; if(this.Options.ShowState=='y') html+='
\ '+ '
'; html+='
'; html+="
"; if(this.Options.ShowZip=='y') html+='
\ '+ '
'; if(this.Options.ShowCountry=='y'){ html+='
\ "+ "
"; } html+='
'; return html; }; sfRedNaoAddress.prototype.GetValueString=function(){ if(this.IsIgnored()) return {streetAddress1:'', streetAddress2:'', city:'', state:'', zip:'', country:'' }; return { streetAddress1:this.JQueryElement.find('.redNaoStreetAddress1').val(), streetAddress2:this.JQueryElement.find('.redNaoStreetAddress2').val(), city:this.JQueryElement.find('.redNaoCity').val(), state:this.JQueryElement.find('.redNaoState').val(), zip:this.JQueryElement.find('.redNaoZip').val(), country:this.JQueryElement.find('.redNaoCountry').val() };}; sfRedNaoAddress.prototype.SetData=function(data){ this.JQueryElement.find('.redNaoStreetAddress1').val(data.streetAddress1); this.JQueryElement.find('.redNaoStreetAddress2').val(data.streetAddress2); this.JQueryElement.find('.redNaoCity').val(data.city); this.JQueryElement.find('.redNaoState').val(data.state); this.JQueryElement.find('.redNaoZip').val(data.zip); this.JQueryElement.find('.redNaoCountry').val(data.country); }; sfRedNaoAddress.prototype.GetValuePath=function(){ return "formData."+this.Id+'.streetAddress1'+ " "+'formData.'+this.Id+'.streetAddress2'+ " "+'formData.'+this.Id+'.city'+ " "+'formData.'+this.Id+'.state'+ " "+'formData.'+this.Id+'.zip'+ " "+'formData.'+this.Id+'.country'; }; sfRedNaoAddress.prototype.IsValid=function(){ if(this.Options.IsRequired=='n') return true; var streetAddress1JQuery=this.JQueryElement.find('.redNaoStreetAddress1'); var streetAddress2JQuery=this.JQueryElement.find('.redNaoStreetAddress2'); var cityJQuery=this.JQueryElement.find('.redNaoCity'); var stateJQuery=this.JQueryElement.find('.redNaoState'); var zipJQuery=this.JQueryElement.find('.redNaoZip'); var countryJQuery=this.JQueryElement.find('.redNaoCountry'); var isValid=true; if(this.Options.ShowStreetAddress1&&streetAddress1JQuery.val()==''){ isValid=false; streetAddress1JQuery.parent().addClass('has-error'); } if(this.Options.ShowCity&&cityJQuery.val()==''){ isValid=false; cityJQuery.parent().addClass('has-error'); } if(this.Options.ShowState&&stateJQuery.val()==''){ isValid=false; stateJQuery.parent().addClass('has-error'); } if(this.Options.ShowZip&&zipJQuery.val()==''){ isValid=false; zipJQuery.parent().addClass('has-error'); } if(this.Options.ShowCountry&&countryJQuery.val()==''){ isValid=false; countryJQuery.parent().addClass('has-error'); } if(!isValid) this.AddError('root',this.InvalidInputMessage); else this.RemoveError('root'); return this.InternalIsValid(); }; sfRedNaoAddress.prototype.GenerationCompleted=function(jQueryElement){ var self=this; this.JQueryElement.find('.redNaoStreetAddress1,.redNaoStreetAddress2,.redNaoCity,.redNaoState,.redNaoZip,.redNaoCountry').change(function(){self.FirePropertyChanged();}); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoStreetAddress1')); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoStreetAddress2')); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoCity')); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoState')); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoZip')); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoCountry')); }; function sfRedNaoPhone(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Phone"; if(this.IsNew){ this.Options.ClassName="rednaophone"; this.Options.Label="Phone"; this.Options.AreaLabel="Area"; this.Options.PhoneLabel="Phone"; this.Options.Icon={ClassName:''}; this.Options.CustomCSS=''; }else{ this.SetDefaultIfUndefined('Icon',{ClassName:''}); this.SetDefaultIfUndefined('CustomCSS',''); }} sfRedNaoPhone.prototype=Object.create(sfFormElementBase.prototype); sfRedNaoPhone.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"IsRequired","Required",{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('icons','Icons and Tweaks').AddProperties([ new SimpleTextProperty(this,this.Options,"AreaLabel","Area Placeholder",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"PhoneLabel","Phone Placeholder",{ManipulatorType:'basic'}), new IconProperty(this,this.Options,'Icon','Icon',{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfRedNaoPhone.prototype.GenerateInlineElement=function(){ var startOfInput=''; var endOfInput=''; if(this.Options.Icon.ClassName!=''){ startOfInput='
'; endOfInput='
'; } var areaLabel=''; var phoneLabel=''; if(this.Options.AreaLabel!='') areaLabel='
'; if(this.Options.PhoneLabel!='') phoneLabel='
'; return '
'+ '
'+ '
'+ '
'+ startOfInput+''+endOfInput+ '
'+ '
'+ ''+ '
'+ '
'+ '
'+ '
'; }; sfRedNaoPhone.prototype.GetValueString=function(){ if(this.IsIgnored()) return {area:'',phone:''}; return { area:this.JQueryElement.find('.redNaoInputArea').val(), phone:this.JQueryElement.find('.redNaoInputPhone').val() };}; sfRedNaoPhone.prototype.SetData=function(data){ this.JQueryElement.find('.redNaoInputArea').val(data.area); this.JQueryElement.find('.redNaoInputPhone').val(data.phone); }; sfRedNaoPhone.prototype.GetValuePath=function(){ return 'formData.'+this.Id+'.area+" "'+'formData.'+this.Id+'.phone'; }; sfRedNaoPhone.prototype.IsValid=function(){ if(this.Options.IsRequired=='y'&&(this.JQueryElement.find('.redNaoInputArea').val()==""||this.JQueryElement.find('.redNaoInputPhone').val()=="")){ var areaJQuery=this.JQueryElement.find('.redNaoInputArea'); var phoneJQuery=this.JQueryElement.find('.redNaoInputPhone'); if(areaJQuery.val()=="") areaJQuery.parent().addClass('has-error'); if(phoneJQuery.val()=="") phoneJQuery.parent().addClass('has-error'); this.AddError('root',this.InvalidInputMessage); } else this.RemoveError('root'); return this.InternalIsValid(); }; sfRedNaoPhone.prototype.GenerationCompleted=function(jQueryElement){ var self=this; this.JQueryElement.find('.redNaoInputArea,.redNaoInputPhone').change(function(){ self.FirePropertyChanged(); }); this.JQueryElement.find('.redNaoInputArea,.redNaoInputPhone').ForceNumericOnly(); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoInputArea')); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoInputPhone')); }; function sfRedNaoEmail(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Text Input"; if(this.IsNew){ this.Options.ClassName="rednaoemail"; this.Options.Label="Email"; this.Options.Placeholder=""; this.Options.Icon={ClassName:''}; this.Options.CustomCSS=''; this.Options.Placeholder_Icon={ClassName:'',Orientation:''}; this.Options.Value=''; this.Options.ReadOnly='n'; }else{ this.SetDefaultIfUndefined('Icon',{ClassName:''}); this.SetDefaultIfUndefined('ReadOnly','n'); this.SetDefaultIfUndefined('CustomCSS',''); this.SetDefaultIfUndefined('Placeholder_Icon',{ClassName:''}); this.SetDefaultIfUndefined('Value',''); }} sfRedNaoEmail.prototype=Object.create(sfFormElementBase.prototype); sfRedNaoEmail.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"IsRequired","Required",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"Value","Default Value",{ManipulatorType:'basic',RefreshFormData:true}).SetEnableFormula() ])); this.Properties.push(new PropertyContainer('icons','Icons and Tweaks').AddProperties([ new SimpleTextProperty(this,this.Options,"Placeholder","Placeholder",{ManipulatorType:'basic',IconOptions:{Type:'leftAndRight'}}), new IconProperty(this,this.Options,'Icon','Icon',{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new CheckBoxProperty(this,this.Options,"ReadOnly","Read Only",{ManipulatorType:'basic'}), new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfRedNaoEmail.prototype.GenerateInlineElement=function(){ var startOfInput=''; var endOfInput=''; if(this.Options.Icon.ClassName!=''){ startOfInput='
'; endOfInput='
'; } return '
'+ '
'+ startOfInput+''+endOfInput+ '
'; }; sfRedNaoEmail.prototype.GetValueString=function(){ if(this.IsIgnored()) return {value:''}; return {value:this.JQueryElement.find('.redNaoEmail').val()};}; sfRedNaoEmail.prototype.SetData=function(data){ this.JQueryElement.find('.redNaoEmail').val(data.value); }; sfRedNaoEmail.prototype.GetValuePath=function(){ return 'formData.'+this.Id+'.value'; }; sfRedNaoEmail.prototype.IsValid=function(){ var email=this.JQueryElement.find('.redNaoEmail').val(); if(email==""&&this.Options.IsRequired=='y'){ this.JQueryElement.addClass('has-error'); this.AddError('root',this.InvalidInputMessage); }else if(email!=''&&!this.EmailIsValid(email)){ this.JQueryElement.addClass('has-error'); this.AddError('root',this.InvalidInputMessage); } else this.RemoveError('root'); return this.InternalIsValid(); }; sfRedNaoEmail.prototype.EmailIsValid=function(email){ var reg=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return reg.test(email); }; sfRedNaoEmail.prototype.GenerationCompleted=function(jQueryElement){ var self=this; this.JQueryElement.find('.redNaoEmail').change(function(){self.FirePropertyChanged();}); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoEmail')); if(this.Options.Placeholder_Icon.ClassName!=''){ this.LoadPlaceHolderIcon(jQueryElement.find('.redNaoInputText'),null,null,this.Options.Placeholder_Icon); }}; function sfRedNaoNumber(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Text Input"; if(this.IsNew){ this.Options.ClassName="rednaonumber"; this.Options.Label="Number"; this.Options.Placeholder=""; this.Options.NumberOfDecimals=0; this.Options.MaximumValue=""; this.Options.MinimumValue=""; this.Options.Decimals=0; this.Options.Icon={ClassName:''}; this.Options.CustomCSS=''; this.Options.Width=""; this.Options.Placeholder_Icon={ClassName:'',Orientation:''}; this.Options.Value=''; }else{ this.SetDefaultIfUndefined("MaximumValue",""); this.SetDefaultIfUndefined("MinimumValue",""); this.SetDefaultIfUndefined('Width',''); this.SetDefaultIfUndefined('Icon',{ClassName:''}); this.SetDefaultIfUndefined('Decimals',0); this.SetDefaultIfUndefined('CustomCSS',''); this.SetDefaultIfUndefined('Placeholder_Icon',{ClassName:''}); this.SetDefaultIfUndefined('Value',''); }} sfRedNaoNumber.prototype=Object.create(sfFormElementBase.prototype); sfRedNaoNumber.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"IsRequired","Required",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"Value","Default Value",{ManipulatorType:'basic',RefreshFormData:true}).SetEnableFormula() ])); this.Properties.push(new PropertyContainer('icons','Icons and Tweaks').AddProperties([ new SimpleTextProperty(this,this.Options,"Placeholder","Placeholder",{ManipulatorType:'basic',IconOptions:{Type:'leftAndRight'}}), new SimpleNumericProperty(this,this.Options,"Width","Width",{ManipulatorType:'basic'}), new SimpleNumericProperty(this,this.Options,"MinimumValue","Minimum Value",{ManipulatorType:'basic',Placeholder:'No Minimum'}), new SimpleNumericProperty(this,this.Options,"MaximumValue","Maximum Value",{ManipulatorType:'basic',Placeholder:'No Maximum'}), new SimpleNumericProperty(this,this.Options,"Decimals","Decimals",{ManipulatorType:'basic'}), new IconProperty(this,this.Options,'Icon','Icon',{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfRedNaoNumber.prototype.GenerateInlineElement=function(){ var additionalStyle=''; if(!isNaN(parseFloat(this.Options.Width))) additionalStyle='width:'+this.Options.Width+'px'+' !important;'; var startOfInput=''; var endOfInput=''; if(this.Options.Icon.ClassName!=''){ startOfInput='
'; endOfInput='
'; } return '
'+ '
'+ startOfInput+''+endOfInput+ '
'; }; sfRedNaoNumber.prototype.GetValueString=function(){ if(this.IsIgnored()) return {value:''}; var number=parseFloat(this.JQueryElement.find('.redNaoNumber').val()); if(isNaN(number)) number=null; return {value:this.JQueryElement.find('.redNaoNumber').val(),numericalValue:number};}; sfRedNaoNumber.prototype.SetData=function(data){ this.JQueryElement.find('.redNaoNumber').val(data.value); }; sfRedNaoNumber.prototype.GetValuePath=function(){ return 'formData.'+this.Id+'.value'; }; sfRedNaoNumber.prototype.IsValid=function(){ var number=this.JQueryElement.find('.redNaoNumber').val(); if(number==""&&this.Options.IsRequired=='y'){ this.JQueryElement.addClass('has-error'); this.AddError('root',this.InvalidInputMessage); } else this.RemoveError('root'); return this.InternalIsValid(); }; sfRedNaoNumber.prototype.InputIsValid=function(){ var inputText=this.JQueryElement.find('.redNaoNumber').val(); if(isNaN(inputText)) return false; var inputNumber=parseFloat(inputText); if(!isNaN(parseInt(this.Options.MaximumValue))){ var maximumValue=parseFloat(this.Options.MaximumValue); if(inputNumber>maximumValue) return false; } if(!isNaN(parseInt(this.Options.MinimumValue))){ var minimumValue=parseFloat(this.Options.MinimumValue); if(inputNumber=0){ var formattedNumber=number.toFixed(decimals); if(formattedNumber!=number) rnJQuery('#'+self.Id+ ' .redNaoNumber').val(formattedNumber); } if(!self.InputIsValid()) rnJQuery('#'+self.Id+ ' .redNaoNumber').val(''); self.FirePropertyChanged();}); this.JQueryElement.find('.redNaoNumber').ForceNumericOnly(this.Options.Decimals); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoNumber')); if(this.Options.Placeholder_Icon.ClassName!=''){ this.LoadPlaceHolderIcon(jQueryElement.find('.redNaoInputText'),null,null,this.Options.Placeholder_Icon); }}; function sfRedNaoCaptcha(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="captcha"; if(this.IsNew){ this.Options.ClassName="rednaocaptcha"; this.Options.Label="Captcha"; this.Options.Theme="red"; this.Options.CustomCSS=''; }else{ this.SetDefaultIfUndefined('CustomCSS',''); } this.Options.Id="captcha"; this.Id="captcha"; } sfRedNaoCaptcha.prototype=Object.create(sfFormElementBase.prototype); sfRedNaoCaptcha.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new CustomCSSProperty(this,this.Options) ])); }; sfRedNaoCaptcha.prototype.GenerateInlineElement=function(){ return '
\
\
'; }; sfRedNaoCaptcha.prototype.StoresInformation=function(){ return false; }; sfRedNaoCaptcha.prototype.GenerationCompleted=function(jQueryElement){ var url=''; if(location.protocol=='https:') url="https://www.google.com/recaptcha/api/js/recaptcha_ajax.js"; else url="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"; rnJQuery.getScript(url, function(){ Recaptcha.create("6Lf2J-wSAAAAACCijq50oACQRuvrsmNt9DeUsE-7", 'captchaComponent', { theme: "red" } ); }); }; function sfHtmlElement(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="HTML Element"; if(this.IsNew){ this.Options.ClassName="rednaohtml"; this.Options.Label="Html"; this.Options.HTML=''; this.Options.CustomCSS=''; }else{ this.SetDefaultIfUndefined('CustomCSS',''); }} sfHtmlElement.prototype=Object.create(sfFormElementBase.prototype); sfHtmlElement.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"HTML","HTML",{ManipulatorType:'basic',RefreshFormData:true,MultipleLine:true}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfHtmlElement.prototype.StoresInformation=function(){ return false; }; sfHtmlElement.prototype.GenerateInlineElement=function(){ if(this.Options.Label!=''){ return '
'+ '
'+ this.Options.HTML+ '
'; }else{ return '
'+ this.Options.HTML+ '
' }}; function sfSearchableList(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Searchable List"; this.DataToLoad=null; if(this.IsNew){ this.Options.Label="Searchable List"; this.Options.ClassName="rednaosearchablelist"; this.Options.DefaultText="Select a value"; this.Options.Options=[{label:'Option 1',value:0,sel:'n',url:''},{label:'Option 2',value:0,sel:'n',url:''},{label:'Option',value:0,sel:'n',url:''}]; this.Options.Multiple='n'; this.Options.CustomCSS=''; }else{ this.SetDefaultIfUndefined('CustomCSS',''); }} sfSearchableList.prototype=Object.create(sfFormElementBase.prototype); sfSearchableList.prototype.CreateProperties=function(){ this.OptionsProperty=new ArrayProperty(this,this.Options,"Options","Options",{ManipulatorType:'basic',SelectorType:(this.Options.Multiple=='n'?'radio':'checkbox'),AllowImages:true}); var self=this; this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"IsRequired","Required",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"Multiple","Multiple Items",{ManipulatorType:'basic',ChangeCallBack:function(newValue,oldValue){ if(newValue=='y') self.OptionsProperty.AdditionalInformation.SelectorType='checkbox'; else self.OptionsProperty.AdditionalInformation.SelectorType='radio'; self.OptionsProperty.RefreshProperty(); }}).SetTooltip("Define if multiple options can be selected or only one"), this.OptionsProperty ])); this.Properties.push(new PropertyContainer('icons','Icons and Tweaks').AddProperties([ new SimpleTextProperty(this,this.Options,"DefaultText","Default text",{ManipulatorType:'basic'}) ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfSearchableList.prototype.GenerateInlineElement=function(){ var additionalStyle=''; if(!isNaN(parseFloat(this.Options.Width))) additionalStyle='width:'+this.Options.Width+'px'+' !important;'; var multiple=''; if(this.Options.Multiple=='y') multiple='multiple="multiple"'; var html='
\
\
'; return html; }; sfSearchableList.prototype.GetSelectedValuesFromNormalSelect=function(){ var selectedOptionIndexes=[]; var $selectedOptions=this.GetRootContainer().find('.redNaoSelect option:selected'); for(var i=0;i<$selectedOptions.length;i++){ var optionIndex=parseInt(rnJQuery($selectedOptions[i]).val()); if(!isNaN(optionIndex)) selectedOptionIndexes.push(optionIndex); } return selectedOptionIndexes; }; sfSearchableList.prototype.GetValueString=function(){ this.amount=0; if(this.IsIgnored()) return {selectedValues:[]}; var data={}; data.selectedValues=[]; var select2SelectedValues; if(this.Select2.hasClass('select2-offscreen')){ select2SelectedValues=this.Select2.select2('val'); if(select2SelectedValues==null) select2SelectedValues=[]; if(!rnJQuery.isArray(select2SelectedValues)){ var aux=select2SelectedValues; select2SelectedValues=[]; if(rnJQuery.trim(aux)!="") select2SelectedValues.push(aux); }} else select2SelectedValues=this.GetSelectedValuesFromNormalSelect(); for(var i=0;i'+RedNaoEscapeHtml(state.text)+''; return ''+RedNaoEscapeHtml(state.text)+''; } function sfFormatSelection(state){ var imageSrc=rnJQuery(state.element).data('imgsrc').toString(); if(imageSrc!='') return ''+RedNaoEscapeHtml(state.text)+''; return ''+RedNaoEscapeHtml(state.text)+''; } /* function SmartFormBasicDataStore(defaultValue){ this.defaultValue='value'; if(typeof defaultValue!=null) this.defaultValue=defaultValue; } SmartFormBasicDataStore.prototype.toString=function(){ return this[this.defaultValue]; }; function SmartFormMultipleItemsDataStore(){ SmartFormBasicDataStore.call(this,''); } SmartFormMultipleItemsDataStore.prototype=Object.create(SmartFormBasicDataStore.prototype); SmartFormMultipleItemsDataStore.prototype.toString=function(){ return RedNaoGetValueFromArray(this.selectedValues); }; SmartFormMultipleItemsDataStore.prototype.IsSelected=function(label){ for(var i=0;i
'; table+='
'; for(var i=0;i'; } table+=''; for(i=0;i'; for(var t=0;t'; } table+=''; } table+="
"; return table; }; sfSurveyTable.prototype.GetValueString=function(){ var result={values:[]}; result.label=this.Options.Label; if(this.IsIgnored()) return result; var $rows=this.JQueryElement.find('.redNaoSurveyRow'); var total=0; for(var i=0;i<$rows.length;i++){ var $processingRow=rnJQuery($rows[i]); var selectedItem=$processingRow.find('input[type="radio"]:checked'); var index=selectedItem.parent().index()-1; if(selectedItem.length==0) continue; total+=parseFloat(this.Options.Columns[index].value); result.values.push({ QuestionLabel:$processingRow.find('.redNaoSurveyQuestion').text(), ValueLabel:this.Options.Columns[index].label, ValueAmount:this.Options.Columns[index].value }); } result.value=total; return result; }; sfSurveyTable.prototype.SetData=function(data){ for(var i=0;i=0&&columnIndex>=0) this.JQueryElement.find('.redNaoSurveyRow').eq(rowIndex).find('.redNaoSurveyRadio').eq(columnIndex).attr('checked','checked'); }}; sfSurveyTable.prototype.GetValuePath=function(){ return 'formData.'+this.Id+'.value'; }; sfSurveyTable.prototype.IsValid=function(){ var isValid=true; if(this.Options.IsRequired=='y'){ var $rows=this.JQueryElement.find('.redNaoSurveyRow'); for(var i=0;i<$rows.length;i++){ if(rnJQuery($rows[i]).find('input[type="radio"]:checked').length==0){ isValid=false; rnJQuery($rows[i]).addClass('redNaoInvalid'); }} } if(!isValid) this.AddError('root',this.InvalidInputMessage); else this.RemoveError('root'); return this.InternalIsValid(); }; sfSurveyTable.prototype.GenerationCompleted=function(jQueryElement){ var self=this; this.JQueryElement.find('.redNaoSurveyRadio').change(function(){self.FirePropertyChanged();}); this.RegisterForFocusEvent(this.JQueryElement.find('.redNaoSurveyRadio')); }; function sfRating(options,serverOptions){ sfFormElementBase.call(this,options,serverOptions); this.Title="Rating"; this.LibraryLoaded=false; if(this.IsNew){ this.Options.ClassName="rednaorating"; this.Options.Label="Rating"; this.Options.Value="5"; this.Options.CustomCSS=""; this.Options.IsRequired='n'; }} sfRating.prototype=Object.create(sfFormElementBase.prototype); sfRating.prototype.CreateProperties=function(){ this.Properties.push(new PropertyContainer('general','General').AddProperties([ new SimpleTextProperty(this,this.Options,"Label","Label",{ManipulatorType:'basic'}), new CheckBoxProperty(this,this.Options,"IsRequired","Required",{ManipulatorType:'basic'}), new SimpleTextProperty(this,this.Options,"Value","Default Value",{ManipulatorType:'basic',RefreshFormData:true}).SetEnableFormula() ])); this.Properties.push(new PropertyContainer('advanced','Advanced').AddProperties([ new IdProperty(this,this.Options), new CustomCSSProperty(this,this.Options) ])); }; sfRating.prototype.GenerateInlineElement=function(){ var rating='
'; rating+='
'; return rating; }; sfRating.prototype.GetValueString=function(){ if(this.IsIgnored()) return {value:''}; if(!this.LibraryLoaded) return {value:this.Options.Value}; return {value:this.JQueryElement.find('.sfRating').rateYo('rating')};}; sfRating.prototype.SetData=function(data){ if(this.LibraryLoaded) this.JQueryElement.find('.sfRating').rateYo('rating',data.value); else this.Options.Value=data.value; }; sfRating.prototype.GetValuePath=function(){ return 'formData.'+this.Id+'.value'; }; sfRating.prototype.IsValid=function(){ var rating=this.JQueryElement.find('.sfRating').rateYo('rating'); var isValid=true; if(this.Options.IsRequired=='y'){ if(rating==0||rating==""){ isValid=false; }} if(!isValid){ this.AddError('root', this.InvalidInputMessage); this.JQueryElement.find('svg').attr('stroke','#a94442'); this.JQueryElement.find('svg').attr('stroke-width','20'); }else{ this.RemoveError('root'); this.JQueryElement.find('svg').removeAttr('stroke'); this.JQueryElement.find('svg').removeAttr('stroke-width'); } return this.InternalIsValid(); }; sfRating.prototype.GenerationCompleted=function(jQueryElement){ var self=this; rnJQuery.RNLoadLibrary([smartFormsPath+'js/utilities/rateyo/jquery.rateyo.min.js'],[smartFormsPath+'js/utilities/rateyo/jquery.rateyo.min.css'],function(){ self.LibraryLoaded=true; self.JQueryElement.find('.sfRating').rateYo({ rating:self.Options.Value, halfStar:true } ); self.JQueryElement.find('.sfRating').on('rateyo.set',function(e,data){ self.FirePropertyChanged(); }); }); };