/** * Load the form */ private function loadForm() { // create the form $this->frm = new FrontendForm('subscribe', null, null, 'subscribeForm'); // create & add elements $this->frm->addText('email')->setAttributes(array('required' => null, 'type' => 'email')); }
/** * Load the form. */ private function loadForm() { $this->frm = new FrontendForm('login', null, null, 'loginForm'); $this->frm->addText('email')->setAttributes(array('required' => null, 'type' => 'email')); $this->frm->addPassword('password')->setAttributes(array('required' => null)); $this->frm->addCheckbox('remember', true); }
/** * Load the form. */ private function loadForm() { $this->frm = new FrontendForm('register', null, null, 'registerForm'); $this->frm->addText('display_name'); $this->frm->addText('email')->setAttributes(array('required' => null, 'type' => 'email')); $this->frm->addPassword('password', null, null, 'inputText showPasswordInput')->setAttributes(array('required' => null)); $this->frm->addCheckbox('show_password'); }
/** * Load the form */ private function loadForm() { // create form $this->frm = new FrontendForm('own_question', '#' . FL::getAction('OwnQuestion')); $this->frm->addText('name')->setAttributes(array('required' => null)); $this->frm->addText('email')->setAttributes(array('required' => null, 'type' => 'email')); $this->frm->addTextarea('message')->setAttributes(array('required' => null)); }
/** * Load the form */ private function loadForm() { // don't show the form if someone is logged in if (FrontendProfilesAuthentication::isLoggedIn()) { return; } $this->frm = new FrontendForm('login', FrontendNavigation::getURLForBlock('Profiles', 'Login')); $this->frm->addText('email')->setAttributes(array('required' => null, 'type' => 'email')); $this->frm->addPassword('password')->setAttributes(array('required' => null)); $this->frm->addCheckbox('remember', true); // parse the form $this->frm->parse($this->tpl); }
/** * Load the form * * @return void */ private function loadForm() { // create the form $this->frm = new FrontendForm('mailmotor_unsubscribe', null, null, 'mailMotorUnsubscribeForm'); // define email $email = null; // request contains an email if ($this->get('request')->request->get('email') != null) { $email = $this->get('request')->request->get('email'); } // create & add elements $this->frm->addText('email', $email); }
/** * Load the form */ private function loadForm() { // create form $this->frm = new FrontendForm('commentsForm'); $this->frm->setAction($this->frm->getAction() . '#' . FL::act('Comment')); // init vars $author = CommonCookie::exists('comment_author') ? CommonCookie::get('comment_author') : null; $email = CommonCookie::exists('comment_email') && \SpoonFilter::isEmail(CommonCookie::get('comment_email')) ? CommonCookie::get('comment_email') : null; $website = CommonCookie::exists('comment_website') && \SpoonFilter::isURL(CommonCookie::get('comment_website')) ? CommonCookie::get('comment_website') : 'http://'; // create elements $this->frm->addText('author', $author)->setAttributes(array('required' => null)); $this->frm->addText('email', $email)->setAttributes(array('required' => null, 'type' => 'email')); $this->frm->addText('website', $website, null); $this->frm->addTextarea('message')->setAttributes(array('required' => null)); }
/** * Load the form. */ private function loadForm() { // gender dropdown values $genderValues = array('male' => \SpoonFilter::ucfirst(FL::getLabel('Male')), 'female' => \SpoonFilter::ucfirst(FL::getLabel('Female'))); // birthdate dropdown values $days = range(1, 31); $months = \SpoonLocale::getMonths(LANGUAGE); $years = range(date('Y'), 1900); // get settings $birthDate = $this->profile->getSetting('birth_date'); $nameChanges = (int) $this->profile->getSetting('display_name_changes'); // get day, month and year if ($birthDate) { list($birthYear, $birthMonth, $birthDay) = explode('-', $birthDate); } else { // no birth date setting $birthDay = ''; $birthMonth = ''; $birthYear = ''; } // create the form $this->frm = new FrontendForm('updateSettings', null, null, 'updateSettingsForm'); // create & add elements $this->frm->addText('display_name', $this->profile->getDisplayName()); $this->frm->addText('first_name', $this->profile->getSetting('first_name')); $this->frm->addText('last_name', $this->profile->getSetting('last_name')); $this->frm->addText('email', $this->profile->getEmail()); $this->frm->addText('city', $this->profile->getSetting('city')); $this->frm->addDropdown('country', Intl::getRegionBundle()->getCountryNames(LANGUAGE), $this->profile->getSetting('country')); $this->frm->addDropdown('gender', $genderValues, $this->profile->getSetting('gender')); $this->frm->addDropdown('day', array_combine($days, $days), $birthDay); $this->frm->addDropdown('month', $months, $birthMonth); $this->frm->addDropdown('year', array_combine($years, $years), (int) $birthYear); // set default elements drop-downs $this->frm->getField('gender')->setDefaultElement(''); $this->frm->getField('day')->setDefaultElement(''); $this->frm->getField('month')->setDefaultElement(''); $this->frm->getField('year')->setDefaultElement(''); $this->frm->getField('country')->setDefaultElement(''); // set email disabled $this->frm->getField('email')->setAttribute('disabled', 'disabled'); // set avatar $this->frm->addImage('avatar'); // when user exceeded the number of name changes set field disabled if ($nameChanges >= FrontendProfilesModel::MAX_DISPLAY_NAME_CHANGES) { $this->frm->getField('display_name')->setAttribute('disabled', 'disabled'); } }
/** * Load the form */ private function loadForm() { // create form $this->frm = new FrontendForm('search', null, 'get', null, false); // could also have been submitted by our widget if (!\SpoonFilter::getGetValue('q', null, '')) { $_GET['q'] = \SpoonFilter::getGetValue('q_widget', null, ''); } // create elements $this->frm->addText('q', null, 255, 'inputText liveSuggest autoComplete', 'inputTextError liveSuggest autoComplete'); // since we know the term just here we should set the canonical url here $canonicalUrl = SITE_URL . FrontendNavigation::getURLForBlock('Search'); if (isset($_GET['q']) && $_GET['q'] != '') { $canonicalUrl .= '?q=' . \SpoonFilter::htmlspecialchars($_GET['q']); } $this->header->setCanonicalUrl($canonicalUrl); }
/** * Load the form. */ private function loadForm() { $this->frm = new FrontendForm('updateEmail', null, null, 'updateEmailForm'); $this->frm->addPassword('password')->setAttributes(array('required' => null)); $this->frm->addText('email', $this->profile->getEmail())->setAttributes(array('required' => null, 'type' => 'email')); }
/** * Load the form. */ private function loadForm() { // create form $this->frm = new FrontendForm('form' . $this->item['id']); // exists and has fields if (!empty($this->item) && !empty($this->item['fields'])) { //dump($this->item['fields'] );die; // loop fields foreach ($this->item['fields'] as $field) { // init $item['name'] = 'field' . $field['id']; $item['type'] = $field['type']; $item['label'] = isset($field['settings']['label']) ? $field['settings']['label'] : ''; $item['placeholder'] = isset($field['settings']['placeholder']) ? $field['settings']['placeholder'] : null; $item['classname'] = isset($field['settings']['classname']) ? $field['settings']['classname'] : null; $item['required'] = isset($field['validations']['required']); $item['validations'] = isset($field['validations']) ? $field['validations'] : []; $item['html'] = ''; // form values $values = isset($field['settings']['values']) ? $field['settings']['values'] : null; $defaultValues = isset($field['settings']['default_values']) ? $field['settings']['default_values'] : null; if ($field['type'] == 'dropdown') { // values and labels are the same $values = array_combine($values, $values); // get index of selected item $defaultIndex = array_search($defaultValues, $values, true); if ($defaultIndex === false) { $defaultIndex = null; } // create element $ddm = $this->frm->addDropdown($item['name'], $values, $defaultIndex, false, $item['classname']); // empty default element $ddm->setDefaultElement(''); // add required attribute if ($item['required']) { $ddm->setAttribute('required', null); } $this->setCustomHTML5ErrorMessages($item, $ddm); // get content $item['html'] = $ddm->parse(); } elseif ($field['type'] == 'radiobutton') { // create element $rbt = $this->frm->addRadiobutton($item['name'], $values, $defaultValues, $item['classname']); // get content $item['html'] = $rbt->parse(); } elseif ($field['type'] == 'checkbox') { // reset $newValues = array(); // rebuild values foreach ($values as $value) { $newValues[] = array('label' => $value, 'value' => $value); } // create element $chk = $this->frm->addMultiCheckbox($item['name'], $newValues, $defaultValues, $item['classname']); // get content $item['html'] = $chk->parse(); } elseif ($field['type'] == 'textbox') { // create element $txt = $this->frm->addText($item['name'], $defaultValues, 255, $item['classname']); // add required attribute if ($item['required']) { $txt->setAttribute('required', null); } if (isset($item['validations']['email'])) { $txt->setAttribute('type', 'email'); } if (isset($item['validations']['numeric'])) { $txt->setAttribute('type', 'number'); } if ($item['placeholder']) { $txt->setAttribute('placeholder', $item['placeholder']); } $this->setCustomHTML5ErrorMessages($item, $txt); // get content $item['html'] = $txt->parse(); } elseif ($field['type'] == 'datetime') { // create element if ($field['settings']['input_type'] == 'date') { // calculate default value $amount = $field['settings']['value_amount']; $type = $field['settings']['value_type']; if ($type != '') { switch ($type) { case 'today': $defaultValues = date('Y-m-d'); // HTML5 input needs this format break; case 'day': case 'week': case 'month': case 'year': if ($amount != '') { $defaultValues = date('Y-m-d', strtotime('+' . $amount . ' ' . $type)); } break; } } // Convert the php date format to a jquery date format $dateFormatShortJS = FrontendFormBuilderModel::convertPHPDateToJquery($this->get('fork.settings')->get('Core', 'date_format_short')); $datetime = $this->frm->addText($item['name'], $defaultValues, 255, 'inputDatefield ' . $item['classname'])->setAttributes(array('data-mask' => $dateFormatShortJS, 'data-firstday' => '1', 'type' => 'date', 'default-date' => !empty($defaultValues) ? date($this->get('fork.settings')->get('Core', 'date_format_short'), strtotime($defaultValues)) : '')); } else { $datetime = $this->frm->addText($item['name'], $defaultValues, 255, $item['classname'])->setAttributes(array('type' => 'time')); } // add required attribute if ($item['required']) { $datetime->setAttribute('required', null); } $this->setCustomHTML5ErrorMessages($item, $datetime); // get content $item['html'] = $datetime->parse(); } elseif ($field['type'] == 'textarea') { // create element $txt = $this->frm->addTextarea($item['name'], $defaultValues, $item['classname']); $txt->setAttribute('cols', 30); // add required attribute if ($item['required']) { $txt->setAttribute('required', null); } if ($item['placeholder']) { $txt->setAttribute('placeholder', $item['placeholder']); } $this->setCustomHTML5ErrorMessages($item, $txt); // get content $item['html'] = $txt->parse(); } elseif ($field['type'] == 'heading') { $item['html'] = '<h3>' . $values . '</h3>'; } elseif ($field['type'] == 'paragraph') { $item['html'] = $values; } elseif ($field['type'] == 'submit') { $item['html'] = $values; } // add to list $this->fieldsHTML[] = $item; } } }
/** * Load the form */ private function loadForm() { $this->frm = new FrontendForm('search', FrontendNavigation::getURLForBlock('Search'), 'get', null, false); $widgetField = $this->frm->addText('q_widget', null, 255, 'inputText autoSuggest', 'inputTextError autoSuggest'); $widgetField->setAttribute('itemprop', 'query-input'); }
/** * Load the form */ private function loadForm() { $this->frm = new FrontendForm('search', FrontendNavigation::getURLForBlock('Search'), 'get', null, false); $this->frm->addText('q_widget', null, 255, 'inputText autoSuggest', 'inputTextError autoSuggest'); }
/** * Load the form */ private function loadForm() { $this->frm = new FrontendForm('forgotPassword', null, null, 'forgotPasswordForm'); $this->frm->addText('email')->setAttributes(array('required' => null, 'type' => 'email')); }