Show The Form Exemple
185494
protected function actionForm()
	{
		$blockCenter = new XmlBlockCollection($this->_myWords->Value("FORM"), BlockPosition::Center);

		$breakLine = new XmlnukeBreakLine();

		$paragraph = new XmlParagraphCollection();
		$blockCenter->addXmlnukeObject($paragraph);

		$paragraph->addXmlnukeObject(new XmlnukeText($this->_myWords->Value("FORMTEXT")));

		$form = new XmlFormCollection($this->_context, $this->_url, $this->_myWords->Value("FORMEDIT"));
		$paragraph->addXmlnukeObject($form);

		$form->setJSValidate(true);
		$form->addXmlnukeObject(new XmlInputHidden("op", "2"));
		$form->addXmlnukeObject(new XmlInputLabelField("Caption", $this->_myWords->Value("VALUE")));

		$text = new XmlInputTextBox($this->_myWords->Value("FIELDREQUIRED"), "field1", "");
		$text->setRequired(true);
		$form->addXmlnukeObject($text);

		$text = new XmlInputDateTime("Date Picker", "date1", DATEFORMAT::DMY, false);
		$form->addXmlnukeObject($text);

		$text = new XmlInputDateTime("Date Picker", "date2", DATEFORMAT::YMD, true);
		$form->addXmlnukeObject($text);

		$text = new XmlInputTextBox($this->_myWords->Value("FIELDEMAIL"), "field2", "");
		$text->setRequired(true);
		$text->setDataType(INPUTTYPE::EMAIL);
		$form->addXmlnukeObject($text);

		$form->addXmlnukeObject(new XmlInputMemo($this->_myWords->Value("MEMO"), "field3", $this->_myWords->Value("VALUE")));
		$form->addXmlnukeObject(new XmlInputCheck($this->_myWords->Value("CHECKBOX"), "check1", $this->_myWords->Value("VALUE")));

		$inputCheck = new XmlInputCheck($this->_myWords->Value("CAPTIONREADONLY"), "check2", $this->_myWords->Value("VALUE"));
		$inputCheck->setChecked(true);
		$inputCheck->setReadOnly(true);
		$form->addXmlnukeObject($inputCheck);

		$inputTextBox = new XmlInputTextBox($this->_myWords->Value("INPUTREADONLY"), "field4", $this->_myWords->Value("VALUE"));
		$inputTextBox->setReadOnly(true);
		$form->addXmlnukeObject($inputTextBox);

		$buttons = new XmlInputButtons();
		$buttons->addSubmit($this->_myWords->Value("SUBMIT"), "bs");
		$buttons->addReset($this->_myWords->Value("RESET"), "br");
		$buttons->addButton($this->_myWords->Value("BUTTON"), "bt", "javascript:alert('ok')");
		$form->addXmlnukeObject($buttons);

		$this->_document->addXmlnukeObject($blockCenter);
	}
158975
function() {
        var form = this.element.find('form:first');

        if (!form) {
            return;
        }

        this.fireEvent('submit', [form]);

        var options = {
            url: form.attr('action'),
            type: (form.attr('method') || 'post').toUpperCase()
        };

        if (window.FormData) {
            options.processData = false;
            options.contentType = false;
            options.data = new FormData(form[0]);
        } else {
            options.data = form.serialize();
        }

        this.requestData(options);
    }
473426
function (form) {
              helpers.render(req, res, view, { form: form, organization: req.organization });
            }
103162
def _fill_form(form):
        
        clicked = False
        last_element = None
        for field in form:
            if field['text']:
                field['element'].clear()
                field['element'].send_keys(field['text'])
            if field['click']:
                field['element'].click()
                clicked = True
            last_element = field['element']
        if last_element:
            if not clicked:
                last_element.submit()
836913
public function showOptionsForm(): void
	{
		$form = new Options\Form($this->options, $this->ADMIN_FORM_ID);
		$form->handleRequest();
		$form->write();
	}
387978
public function view()
    {
        $this->setPageType('form');
        $this->setTitle(__('%1$s &ndash; %2$s', array(__('Preferences'), __('Symphony'))));
        $this->addElementToHead(new XMLElement('link', null, array(
            'rel' => 'canonical',
            'href' => SYMPHONY_URL . '/system/preferences/',
        )));
        $this->appendSubheading(__('Preferences'));

        $bIsWritable = true;
        $formHasErrors = (is_array($this->_errors) && !empty($this->_errors));

        if (General::checkFileWritable(CONFIG) === false) {
            $this->pageAlert(__('The Symphony configuration file, %s, or folder is not writable. You will not be able to save changes to preferences.', array('<code>/manifest/config.php</code>')), Alert::ERROR);
            $bIsWritable = false;
        } elseif ($formHasErrors) {
            $this->pageAlert(
                __('An error occurred while processing this form. See below for details.'), Alert::ERROR
            );
        } elseif (isset($this->_context[0]) && $this->_context[0] == 'success') {
            $this->pageAlert(__('Preferences saved.'), Alert::SUCCESS);
        }

        // Get available languages
        $languages = Lang::getAvailableLanguages();

        if (count($languages) > 1) {
            // Create language selection
            $group = new XMLElement('fieldset');
            $group->setAttribute('class', 'settings');
            $group->appendChild(new XMLElement('legend', __('System Language')));
            $label = Widget::Label();

            // Get language names
            asort($languages);

            $options = array();
            foreach ($languages as $code => $name) {
                $options[] = array($code, $code == Symphony::Configuration()->get('lang', 'symphony'), $name);
            }

            $select = Widget::Select('settings[symphony][lang]', $options);
            $label->appendChild($select);
            $group->appendChild($label);
            $group->appendChild(new XMLElement('p', __('Authors can set up a differing language in their profiles.'), array('class' => 'help')));
            // Append language selection
            $this->Form->appendChild($group);
        }

        // Get available EmailGateways
        $email_gateways = EmailGatewayManager::listAll();

        if (count($email_gateways) >= 1) {
            $group = new XMLElement('fieldset', null, array('class' => 'settings condensed'));
            $group->appendChild(new XMLElement('legend', __('Default Email Settings')));
            $label = Widget::Label(__('Gateway'));

            // Get gateway names
            ksort($email_gateways);

            $default_gateway = EmailGatewayManager::getDefaultGateway();
            $selected_is_installed = EmailGatewayManager::__getClassPath($default_gateway);

            $options = array();

            foreach ($email_gateways as $handle => $details) {
                $options[] = array($handle, (($handle == $default_gateway) || (($selected_is_installed == false) && $handle == 'sendmail')), $details['name']);
            }

            $select = Widget::Select('settings[Email][default_gateway]', $options, array('class' => 'picker', 'data-interactive' => 'data-interactive'));
            $label->appendChild($select);
            $group->appendChild($label);
            // Append email gateway selection
            $this->Form->appendChild($group);
        }

        foreach ($email_gateways as $gateway) {
            $gateway_settings = EmailGatewayManager::create($gateway['handle'])->getPreferencesPane();

            if (is_a($gateway_settings, 'XMLElement')) {
                $this->Form->appendChild($gateway_settings);
            }
        }

        // Get available cache drivers
        $caches = Symphony::ExtensionManager()->getProvidersOf('cache');
        // Add default Symphony cache driver..
        $caches['database'] = 'Database';

        if (count($caches) > 1) {
            $group = new XMLElement('fieldset', null, array('class' => 'settings condensed'));
            $group->appendChild(new XMLElement('legend', __('Default Cache Settings')));

            /**
             * Add custom Caching groups. For example a Datasource extension might want to add in the ability
             * for set a cache driver for it's functionality. This should usually be a dropdown, which allows
             * a developer to select what driver they want to use for caching. This choice is stored in the
             * Configuration in a Caching node.
             * eg.
             *  'caching' => array (
             *        'remote_datasource' => 'database',
             *        'dynamic_ds' => 'YourCachingExtensionClassName'
             *  )
             *
             * @since Symphony 2.4
             * @delegate AddCachingOpportunity
             * @param string $context
             * '/system/preferences/'
             * @param XMLElement $wrapper
             *  An XMLElement of the current Caching fieldset
             * @param string $config_path
             *  The node in the Configuration where this information will be stored. Read only.
             * @param array $available_caches
             *  An array of the available cache providers
             * @param array $errors
             *  An array of errors
             */
            Symphony::ExtensionManager()->notifyMembers('AddCachingOpportunity', '/system/preferences/', array(
                'wrapper' => &$group,
                'config_path' => 'caching',
                'available_caches' => $caches,
                'errors' => $this->_errors
            ));

            $this->Form->appendChild($group);
        }

        /**
         * Add Extension custom preferences. Use the $wrapper reference to append objects.
         *
         * @delegate AddCustomPreferenceFieldsets
         * @param string $context
         * '/system/preferences/'
         * @param XMLElement $wrapper
         *  An XMLElement of the current page
         * @param array $errors
         *  An array of errors
         */
        Symphony::ExtensionManager()->notifyMembers('AddCustomPreferenceFieldsets', '/system/preferences/', array(
            'wrapper' => &$this->Form,
            'errors' => $this->_errors
        ));

        $div = new XMLElement('div');
        $div->setAttribute('class', 'actions');

        $version = new XMLElement('p', 'Symphony ' . Symphony::Configuration()->get('version', 'symphony'), array(
            'id' => 'version'
        ));
        $div->appendChild($version);

        $attr = array('accesskey' => 's');

        if (!$bIsWritable) {
            $attr['disabled'] = 'disabled';
        }

        $div->appendChild(Widget::Input('action[save]', __('Save Changes'), 'submit', $attr));

        $this->Form->appendChild($div);
    }
1335338
public function RenderBegin () {
		$this->form->PreDispatch();
		$result = "<form";
		$attrs = [];
		$form = & $this->form;
		// standard attributes
		$formProperties = ['id', 'action', 'method', 'enctype', 'target'];
		foreach ($formProperties as $property) {
			$getter = 'Get'.ucfirst($property);
			$formPropertyValue = $form->$getter();
			if ($formPropertyValue !== NULL)
				$attrs[$property] = $formPropertyValue;
		}
		// css classes
		$formCssClasses = $form->GetCssClasses();
		if ($formCssClasses)
			$attrs['class'] = gettype($formCssClasses) == 'array'
				? implode(' ', (array) $formCssClasses)
				: $formCssClasses;
		// additional custom attributes completing
		foreach ($form->GetAttributes() as $key => $value) {
			if (!in_array($key, $formProperties))
				$attrs[$key] = $value;
		}
		// pseudo-boolean attributes completing
		$formAutoComplete = $form->GetAutoComplete();
		if ($formAutoComplete !== NULL) 
			$attrs['autocomplete'] = $formAutoComplete ? 'on' : 'off';
		$formNoValidate = $form->GetNoValidate();
		if ($formNoValidate === TRUE)
			$attrs['novalidate'] = 'novalidate';
		$formAcceptCharsets = $form->GetAcceptCharsets();
		if (count($formAcceptCharsets) > 0) 
			$attrs['accept-charset'] = implode(' ', $formAcceptCharsets);
		// boolean and additional attributes
		$attrsStr = self::RenderAttrs($attrs);
		if ($attrsStr) $result .= ' ' . $attrsStr;
		$result .= '>';
		$this->form->SetFormTagRenderingStatus(TRUE);
		$result .= $this->RenderCsrf();
		return $result;
	}
585180
def render_form(form, **kwargs):
    
    renderer_cls = get_form_renderer(**kwargs)
    return renderer_cls(form, **kwargs).render()
1086385
def mangle_form(form):
    ""
    for field, widget in form.fields.iteritems():
        if type(widget) is forms.widgets.TextInput:
            form.fields[field].widget = PaperTextInput()
            form.fields[field].label = ''
        if type(widget) is forms.widgets.PasswordInput:
            field.widget = PaperPasswordInput()
            field.label = ''
    return form
377109
def render_done(self, form, **kwargs):
        
        final_form_list = []
        # walk through the form list and try to validate the data again.
        for form_key in self.get_form_list():
            form_obj = self.get_form(step=form_key,
                data=self.storage.get_step_data(form_key),
                files=self.storage.get_step_files(form_key))
            if not form_obj.is_valid():
                return self.render_revalidation_failure(form_key, form_obj, **kwargs)
            final_form_list.append(form_obj)

        # render the done view and reset the wizard before returning the
        # response. This is needed to prevent from rendering done with the
        # same data twice.
        done_response = self.done(final_form_list, **kwargs)
        self.storage.reset()
        return done_response
122868
protected function InitForm()
    {
        $this->logout = $this->LoadElement();
        $this->AddNextUrlField();
        $this->AddCssIDField();
        $this->AddCssClassField();
        $this->AddTemplateField();
        $this->AddSubmit();
    }
890455
function finishForm(&$form){
        global $PAGE;
        if ($form->isFrozen()){
            $this->_hiddenHtml = '';
        }
        parent::finishForm($form);
        $this->_html = str_replace('{collapsebtns}', $this->_collapseButtons, $this->_html);
        if (!$form->isFrozen()) {
            $args = $form->getLockOptionObject();
            if (count($args[1]) > 0) {
                $PAGE->requires->js_init_call('M.form.initFormDependencies', $args, true, moodleform::get_js_module());
            }
        }
    }
230869
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);

        //add property action in toolbar
        $actions     = tao_helpers_form_FormFactory::getCommonActions();
        $propertyElt = tao_helpers_form_FormFactory::getElement('property', 'Free');
        $propertyElt->setValue(
            "<a href='#' class='btn-info property-adder small'><span class='icon-property-add'></span> " . __('Add property') . "</a>"
        );
        $actions[] = $propertyElt;

        //property mode
        $propModeELt = tao_helpers_form_FormFactory::getElement('propMode', 'Free');
        if($this->propertyMode == 'advanced'){
            $propModeELt->setValue("<a href='#' class='btn-info property-mode small property-mode-simple'><span class='icon-property-advanced'></span> ".__('Simple Mode')."</a>");
        }
        else{
            $propModeELt->setValue("<a href='#' class='btn-info property-mode small property-mode-advanced'><span class='icon-property-advanced'></span> ".__('Advanced Mode')."</a>");
        }

        $actions[] = $propModeELt;

        //add a hidden field that states it is a class edition form.
        $classElt = tao_helpers_form_FormFactory::getElement('tao.forms.class', 'Hidden');
        $classElt->setValue('1');
        $classElt->addClass('global');
        $this->form->addElement($classElt);

        $this->form->setActions($actions, 'top');
        $this->form->setActions($actions, 'bottom');


    }
26829
def render(self, form=None, **kwargs):
        
        form = form or self.get_form()
        context = self.get_context_data(form, **kwargs)
        return self.render_to_response(context)
671402
protected function InitForm()
    {
        $this->container = $this->LoadElement();
        $this->AddContainerField();
        $this->AddCssClassField();
        $this->AddCssIDField();
        $this->AddSubmit();
    }
723214
public function definition() {
        $mform = $this->_form;
        $instance = $this->_customdata;

        // Visible elements.
        $mform->addElement('html', $instance['gradingtable']);

        // Hidden params.
        $mform->addElement('hidden', 'id', $instance['cm']);
        $mform->setType('id', PARAM_INT);
        $mform->addElement('hidden', 'action', 'quickgrade');
        $mform->setType('action', PARAM_ALPHA);
        $mform->addElement('hidden', 'lastpage', $instance['page']);
        $mform->setType('lastpage', PARAM_INT);

        // Skip notifications option.
        $mform->addElement('selectyesno', 'sendstudentnotifications', get_string('sendstudentnotifications', 'assign'));
        $mform->setDefault('sendstudentnotifications', $instance['sendstudentnotifications']);

        // Buttons.
        $savemessage = get_string('saveallquickgradingchanges', 'assign');
        $mform->addElement('submit', 'savequickgrades', $savemessage);
    }
1277855
protected function InitForm()
    {
        $this->submit = $this->LoadElement();
        
        $this->AddNameField();
        $this->AddValueField();
        
        $this->AddCssIDField();
        $this->AddCssClassField();
        $this->AddTemplateField();
        $this->AddSubmit();
    }