Override method for creating FormBaseNew form
163849
def create(self):
        
        self.add_handlers({'^T': self.quit, '^Q': self.quit})
        self.services_tft = self.add(npyscreen.TitleFixedText,
                                     name='No services running.',
                                     value='')
        services = Services(self.core, external=self.external)
        if services:
            self.services_tft.hidden = True
            for service in services:
                value = ''
                for val in service[1]:
                    value += val+', '
                self.add(npyscreen.TitleFixedText,
                         name=service[0],
                         value=value[:-2])
387403
private void createExampleUi() {
		add(new WHeading(HeadingLevel.H2, "Contacts"));

		add(repeater);
		WButton addBtn = new WButton("Add");
		addBtn.setAction(new Action() {
			@Override
			public void execute(final ActionEvent event) {
				addNewContact();
			}
		});
		newNameField.setDefaultSubmitButton(addBtn);

		WButton printBtn = new WButton("Print");
		printBtn.setAction(new Action() {
			@Override
			public void execute(final ActionEvent event) {
				printEditedDetails();
			}
		});

		WFieldLayout layout = new WFieldLayout();
		add(layout);
		layout.addField("New contact name", newNameField);
		layout.addField((WLabel) null, addBtn);
		layout.addField("Print output", console);
		layout.addField((WLabel) null, printBtn);

		// Ajax controls to make things zippier
		add(new WAjaxControl(addBtn, new AjaxTarget[]{repeater, newNameField}));
		add(new WAjaxControl(printBtn, console));
	}
1006090
public function doAddNew($data, $form)
    {
        $obj = Object::create($this->addNewClass);
        if (!$obj->canCreate()) {
            return Security::permissionFailure(Controller::curr(), "You don't have permission to create this object");
        }
        $form->saveInto($obj);

        try {
            $obj->write();
        } catch (Exception $e) {
            $form->setMessage($e->getMessage(), 'error');
            return $form->forTemplate();
        }

        $callback = $this->sourceCallback;
        $items = $callback($obj);
        $this->owner->setSource($items);

        // if this field is a multiselect field, we add the new Object ID to the existing
        // options that are selected on the field then set that as the value
        // otherwise we just set the new Object ID as the value
        if (isset($data['existing'])) {
            $existing = $data['existing'];
            $value = explode(',', $existing);
            $value[] = $obj->ID;
        } else {
            $value = $obj->ID;
        }

        $this->owner->setValue($value);
        // NOTE(Jake): Below line causes cyclic issues, I assume it's not necessary.
        //$this->owner->setForm($form);
        return $this->owner->FieldHolder();
    }
588856
function _attachChangeAndDefaultFileEvent(form_id) {
        var _this = this;

        var elements = this._collection[form_id].getInputs();
        [].forEach.call(elements, function (form_control) {

            _this.__attachSingleChangeEvent(form_id, form_control);
            _this.__observeSingleValueChange(form_id, form_control);

            // set default file input value
            if (form_control.type === 'file' && form_control.hasAttribute('value')) {
                var url = form_control.getAttribute('value');
                if (url !== '') {
                    _this.setFileFromUrl(form_id, form_control.name, url);
                }
            }
        });
    }
1169542
public static FormElement generateHiddenForm(
        String action,
        Method method,
        String target,
        Map<String, String> values) {

        FormElement formElement = Document.get().createFormElement();
        formElement.setMethod(method.name());
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(target)) {
            formElement.setTarget(target);
        }
        formElement.setAction(action);
        for (Entry<String, String> input : values.entrySet()) {
            formElement.appendChild(createHiddenInput(input.getKey(), input.getValue()));
        }
        return formElement;
    }
1216061
def add_form(self, form, form_name, form_args):
        
        self.parentApp.addForm(form_name, form, **form_args)
        self.parentApp.change_form(form_name)
        return
696363
function() {
	  this.setBackReferenceOnFieldOptionsRecursively(this.fields);
      
      var groupParams = {parentEl: this.bodyEl, fields: this.fields, legend: this.legend, collapsible: this.collapsible};
      this.form = new inputEx.Group(groupParams);

		// Redraw all wires when the form is collapsed
		if(this.form.legend) {
			YAHOO.util.Event.addListener(this.form.legend, 'click', function() {
				
				// Override the getXY method on field terminals:
				var that = this;
				for(var i = 0 ; i < this.form.inputs.length ; i++) {
					var field = this.form.inputs[i];
					if(field.terminal) {
						field.terminal.getXY = function() {
							if( YAHOO.util.Dom.hasClass(that.form.fieldset, "inputEx-Collapsed") ) {
								return that.getXY();
							}
							else {
								return WireIt.Terminal.prototype.getXY.call(this);
							}
							
						};
					}
				}
				
				this.redrawAllWires();
			}, this, true);
		}
   }
983464
private void overrideDatabaseTerminationToken(Map<Object, Object> props) {
        String overrideTermToken = null;
        String platformClassName = _dbMgr.getDatabasePlatformClassName(_pui);

        if (platformClassName != null) {
            overrideTermToken = platformTerminationToken.get(platformClassName);
        }

        if (overrideTermToken != null) {
            String existing = (String) props.get(PersistenceUnitProperties.TARGET_DATABASE_PROPERTIES);
            if (existing != null) {
                existing = existing + ",";
            } else {
                existing = "";
            }
            existing = (existing + "StoredProcedureTerminationToken=" + overrideTermToken);

            props.put(PersistenceUnitProperties.TARGET_DATABASE_PROPERTIES, existing);
        }
    }
604692
public function AddNewForm()
    {
        $action    = FormAction::create('doAddNew', _t('QUICKADDNEW.Add', 'Add'))->setUseButtonTag('true');

        if (!$this->isFrontend) {
            $action->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept');
        }

        $actions = FieldList::create($action);
        $form = Form::create($this->owner, 'AddNewForm', $this->addNewFields, $actions, $this->addNewRequiredFields);

        $this->owner->extend('updateQuickAddNewForm', $form);

        return $form;
    }
1096416
def save_form(self, request, form, change):
        """"""
        instance = super(PageAdmin, self).save_form(request, form, change)
        instance.template = form.cleaned_data['template']
        if not change:
            instance.author = request.user
        return instance
1129135
@Override
    public JobProperty<?> newInstance(StaplerRequest req, JSONObject formData) throws FormException {
        // JobPropertyDescriptors are bit different in that we allow them even without any user-visible configuration parameter,
        // so replace the lack of form data by an empty one. 
        if(formData.isNullObject()) formData=new JSONObject();

        return super.newInstance(req, formData);
    }
109445
def new_control(self, type, name, value, **kwargs):
        """"""
        return self.get_current_form().new_control(type, name, value, **kwargs)
593247
public function createForm($entity, $formFactory, $action = null, $options = [])
    {
        if (!$entity instanceof ContactClient) {
            throw new MethodNotAllowedHttpException(['ContactClient']);
        }

        if (!empty($action)) {
            $options['action'] = $action;
        }

        // Prevent clone action from complaining about extra fields.
        $options['allow_extra_fields'] = true;

        return $formFactory->create('contactclient', $entity, $options);
    }
1195176
public static <T extends RepositoryBrowser>
    T createInstance(Class<T> type, StaplerRequest req, JSONObject parent, String fieldName) throws FormException {
        JSONObject o = (JSONObject)parent.get(fieldName);
        if(o==null) return null;

        return req.bindJSON(type,o);
    }
1265616
private static <T, G extends T> void generateDrawMethods(DexMaker dexMaker,
                                                             TypeId<G> generatedType,
                                                             TypeId<T> baseType) {
        generateDrawMethod(dexMaker, generatedType, baseType, ViewMethod.DRAW);
        generateDrawMethod(dexMaker, generatedType, baseType, ViewMethod.ON_DRAW);
    }
1137160
function () {
        var self = this, items = self.items();

        if (!self.settings.formItemDefaults) {
          self.settings.formItemDefaults = {
            layout: 'flex',
            autoResize: "overflow",
            defaults: { flex: 1 }
          };
        }

        // Wrap any labeled items in FormItems
        items.each(function (ctrl) {
          var formItem, label = ctrl.settings.label;

          if (label) {
            formItem = new FormItem(Tools.extend({
              items: {
                type: 'label',
                id: ctrl._id + '-l',
                text: label,
                flex: 0,
                forId: ctrl._id,
                disabled: ctrl.disabled()
              }
            }, self.settings.formItemDefaults));

            formItem.type = 'formitem';
            ctrl.aria('labelledby', ctrl._id + '-l');

            if (typeof ctrl.settings.flex == "undefined") {
              ctrl.settings.flex = 1;
            }

            self.replace(ctrl, formItem);
            formItem.add(ctrl);
          }
        });
      }
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');
    }