When adding form rules clear all previous rules for any conflicting form_templates
557318
protected function _afterRun()
    {
        foreach ($this->_formTemplateRulesToDelete as $template => $fields) {
            BlockFormRule::where('form_template', '=', $template)->whereIn('field', array_keys($fields))->delete();
        }
    }
353899
def conflicting_plugin_message():
    
    message = m.Message()
    message.add(LOGO_ELEMENT)
    message.add(m.Heading(tr('Conflicting plugin detected'), **WARNING_STYLE))
    notes = m.Paragraph(conflicting_plugin_string())
    message.add(notes)
    return message
659087
def _clean_fields(self):
        
        try:
            super(OAuthForm, self)._clean_fields()
        except OAuthValidationError, e:
            self._errors.update(e.args[0])
519632
function( form ) {
		var inputGroups = form.find( '.inputGroup' ), 
			isValid = true,
			inputGroup, 
			i;

		for( i = 0; i < inputGroups.length; i++ ) {
			inputGroup = $( inputGroups[ i ] );
			
			if( $.trim( inputGroup.find( 'input' ).val() ).length === 0 ) {
				inputGroup.addClass( 'error' );
				isValid = false;
			} else {
				inputGroup.removeClass( 'error' );
			}
		}

		return isValid;
	}
467844
def auto_correct_incomplete?(rule)
      todo_reader = Rubocop::TodoReader.new(options[:file_path])
      todo_reader.all_rules.include?(rule)
    end
506492
protected function initForm()
    {
    	(isset($this->options['name'])) ? $name = $this->options['name'] : $name = ''; 
    	if(empty($name)){
			$name = 'form_'.(count(self::$forms)+1);
		}
		unset($this->options['name']);
			
		$this->form = \tao_helpers_form_FormFactory::getForm($name, $this->options);
		
		//create action in toolbar
		$createElt = \tao_helpers_form_FormFactory::getElement('create', 'Free');
		$createElt->setValue('<button class="btn-info" type="submit" id="addButton">'.\tao_helpers_Icon::iconAdd().__('Create').'</button>');
		$this->form->setActions(array(), 'top');
		$this->form->setActions(array($createElt), 'bottom');
    }
481590
public function update_rules() {
		$post_types = CPTP_Util::get_post_types();
		foreach ( $post_types as $post_type ) {
			add_action( 'update_option_' . $post_type . '_structure', array( __CLASS__, 'queue_flush_rules' ), 10, 2 );
		}
		add_action( 'update_option_no_taxonomy_structure', array( __CLASS__, 'queue_flush_rules' ), 10, 2 );
	}
1010958
def bootstrapped_form object, options={}, &block
      options[:builder] = BootstrapFormBuilder
      form_for object, options, &block
    end
1038837
function _setDefaultRuleMessages(){
        foreach ($this->_rules as $field => $rulesarr){
            foreach ($rulesarr as $key => $rule){
                if ($rule['message']===null){
                    $a=new stdClass();
                    $a->format=$rule['format'];
                    $str=get_string('err_'.$rule['type'], 'form', $a);
                    if (strpos($str, '[[')!==0){
                        $this->_rules[$field][$key]['message']=$str;
                    }
                }
            }
        }
    }
438210
public function formExtendFields($form)
    {
        $model = $form->model;
        $theme = $this->findThemeObject($model->theme);
        $config = $theme->getFormConfig();

        if ($fields = array_get($config, 'fields')) {
            $form->addFields($fields);
        }

        if ($fields = array_get($config, 'tabs.fields')) {
            $form->addTabFields($fields);
        }

        if ($fields = array_get($config, 'secondaryTabs.fields')) {
            $form->addSecondaryTabFields($fields);
        }
    }
519410
public function updateEditForm($form){
		if($this->modelIsMultiSitesAware()) {
			$managedSites = Multisites::inst()->sitesManagedByMember();
			$source = Site::get()->filter('ID', Multisites::inst()->sitesManagedByMember())->map('ID', 'Title')->toArray();
			$plural = singleton($this->owner->modelClass)->plural_name();
			if(!count($source)){
				$form->setFields(FieldList::create(
					LiteralField::create('NotAManager', "You do not have permission to manage $plural on any Sites")
				));
			}
		}
	}
721784
public function applyRules($form) {
		if (method_exists($form, 'getValidateRules')) {
			$this->rules = array_merge($this->rules, $form->getValidateRules());
		}

		return $this;
	}
656676
def patch_clean_fields(model):
    
    old_clean_fields = model.clean_fields

    def new_clean_fields(self, exclude=None):
        if hasattr(self, '_mt_form_pending_clear'):
            # Some form translation fields has been marked as clearing value.
            # Check if corresponding translated field was also saved (not excluded):
            # - if yes, it seems like form for MT-unaware app. Ignore clearing (left value from
            #   translated field unchanged), as if field was omitted from form
            # - if no, then proceed as normally: clear the field
            for field_name, value in self._mt_form_pending_clear.items():
                field = self._meta.get_field(field_name)
                orig_field_name = field.translated_field.name
                if orig_field_name in exclude:
                    field.save_form_data(self, value, check=False)
            delattr(self, '_mt_form_pending_clear')
        old_clean_fields(self, exclude)
    model.clean_fields = new_clean_fields
1213841
function(current_templates) {

		var i = 1,
			count = current_templates.length,
			guid,
			previous_template = current_templates[0];

		if (previous_template) { // if list is not empty

			delete this._remove_queue[previous_template.guid];

			// handle first template separately from others
			if (!previous_template.isInDOM()) {

				this._insertFirstTemplate(previous_template);
				this._fire('insertion_complete', previous_template);

			}

			for (; i < count; i++) {

				delete this._remove_queue[current_templates[i].guid];

				if (current_templates[i].isInDOM()) {

					this._moveTemplate(current_templates[i], previous_template, current_templates);

				} else {

					this._insertTemplate(current_templates[i], previous_template, i);
					this._fire('insertion_complete', current_templates[i]);

				}

				previous_template = current_templates[i];

			}

		}

		for (guid in this._remove_queue) {

			if (this._remove_queue[guid].isInDOM()) {

				this._removeTemplate(this._remove_queue[guid]);
				this._fire('removal_complete', this._remove_queue[guid]);

			}

		}

		this._remove_queue = {};

	}
96220
public function removeAllValidation()
    {
        if ($this->form) {
            foreach ($this->constraints as $fieldName => $constraints) {
                foreach ($constraints as $constraint) {
                    $constraint->removeParsley();
                    unset($constraint);
                }
            }
        }
        $this->constraints = array();
    }
592268
def all_valid_with_nesting(self, formsets):
        ""
        if not all_valid(formsets):
            return False

        for formset in formsets:
            if not formset.is_bound:
                pass
            for form in formset:
                if hasattr(form, 'nested_formsets'):
                    if not self.all_valid_with_nesting(form.nested_formsets):
                        return False

                    #TODO - find out why this breaks when extra = 1 and just adding new item with no sub items
                    if (not hasattr(form, 'cleaned_data') or not form.cleaned_data) and self.formset_has_nested_data(form.nested_formsets):
                        form._errors["__all__"] = form.error_class(["Parent object must be created when creating nested inlines."])
                        return False
        return True
330312
private function cleanForm($requestData, Form $form)
    {
        $allowedField = array_keys($requestData);

        /** @var FormInterface[] $formFields */
        $formFields = $form->all();
        foreach ($formFields as $formField) {
            $fieldName = $formField->getName();

            if (!in_array($fieldName, $allowedField)) {
                $form->remove($fieldName);
            }
        }
    }