| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | Mark Forums Read | User manuals | Login |
Dealing wiht Form in X-Cart 5 | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Dealing wiht Form in X-Cart 5
Hello, I create a form. This is my class that define my form widget :
<?php namespace XLite\Module\Fdmteam\Xretur\View\Model ; class ReturForm extends \XLite\View\Model\AModel { /** * @inheritdoc */ public function __construct($params = [], $sections = []) { $this->schemaDefault = [ 'name' => [ self::SCHEMA_CLASS => '\XLite\View\FormField\Input\Text', self::SCHEMA_LABEL => static::t('Name'), self::SCHEMA_PLACEHOLDER => static::t('Name'), self::SCHEMA_REQUIRED => true, ], 'email' => [ self::SCHEMA_CLASS => '\XLite\View\FormField\Input\Text\Email', self::SCHEMA_LABEL => static::t('Email'), self::SCHEMA_PLACEHOLDER => static::t('Email'), self::SCHEMA_REQUIRED => true, ], 'phone' => [ self::SCHEMA_CLASS => '\XLite\View\FormField\Input\Text\Phone', self::SCHEMA_LABEL => static::t('Phone'), self::SCHEMA_PLACEHOLDER => static::t('Phone'), self::SCHEMA_REQUIRED => true, ], 'invoice_number' => [ self::SCHEMA_CLASS => '\XLite\View\FormField\Input\Text\Integer', self::SCHEMA_LABEL => static::t('Invoice'), self::SCHEMA_PLACEHOLDER => static::t('Invoice Number'), self::SCHEMA_REQUIRED => true, ], 'reason' => [ self::SCHEMA_CLASS => '\XLite\Module\Fdmteam\Xretur\View\FormField\Selec t\Reasons', self::SCHEMA_LABEL => static::t('Reason'), self::SCHEMA_PLACEHOLDER => static::t('Reason'), self::SCHEMA_REQUIRED => true, \XLite\View\FormField\AFormField::FIELD_TYPE_SELEC T => true, ], 'desire' => [ self::SCHEMA_CLASS => '\XLite\Module\Fdmteam\Xretur\View\FormField\Selec t\Desireds', self::SCHEMA_LABEL => static::t('Desired'), self::SCHEMA_PLACEHOLDER => static::t('Desired'), self::SCHEMA_REQUIRED => true, \XLite\View\FormField\AFormField::FIELD_TYPE_SELEC T => true, ], 'date' => [ self::SCHEMA_CLASS => '\XLite\Module\Fdmteam\Xretur\View\FormField\Input \Text\DatePicker', self::SCHEMA_LABEL => static::t('Date'), self::SCHEMA_REQUIRED => true, self::SCHEMA_PLACEHOLDER => static::t('Date'), \XLite\View\FormField\AFormField::PARAM_FIELD_ONLY => false, ], 'message' => [ self::SCHEMA_CLASS => '\XLite\View\FormField\Textarea\Simple', self::SCHEMA_LABEL => static::t('Message'), self::SCHEMA_PLACEHOLDER => static::t('Message'), self::SCHEMA_REQUIRED => true, \XLite\View\FormField\Textarea\ATextarea::PARAM_RO WS => 5, \XLite\View\FormField\Textarea\ATextarea::PARAM_CO LS => 21 ], 'table' => [ self::SCHEMA_CLASS => '\XLite\Module\Fdmteam\Xretur\View\FormField\Table \CustomTable', self::SCHEMA_LABEL => static::t('Table'), self::SCHEMA_PLACEHOLDER => static::t('Aici trebuie sa pun tabelul'), self::SCHEMA_REQUIRED => true, \XLite\View\FormField\AFormField::PARAM_FIELD_ONLY => false, ], ]; parent::__construct($params, $sections); } public function getModelId() { return \XLite\Core\Request::getInstance()->id; } protected function getDefaultModelObject() { $model = $this->getModelId() ? \XLite\Core\Database::getRepo('XLite\Module\Fdmtea m\Xretur\Model\FormRetur')->find($this->getModelId()) : null; return $model ?: new \XLite\Module\Fdmteam\Xretur\Model\FormRetur ; } protected function getFormClass() { return '\XLite\Module\Fdmteam\Xretur\View\Form\Model\Retu rForm'; } /** * Return list of the "Button" widgets * * @return array */ protected function getFormButtons() { $result = parent::getFormButtons(); $result['submit'] = new \XLite\View\Button\Submit( [ \XLite\View\Button\AButton::PARAM_LABEL => static::t('Send Form'), \XLite\View\Button\AButton::PARAM_BTN_TYPE => 'btn regular-main-button submit' ] ); return $result; } } Is there a way to split this form in two separated columns when i render the widget in my view without apply any particular css styles or something, only using x-cart configs ?! This is my view <div class="form-wrapper"> {{ widget('\\XLite\\Module\\Fdmteam\\Xretur\\View\\Mo del\\ReturForm') }} </div>
__________________
Soptareanu Alex |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Dealing wiht Form in X-Cart 5
There is no built-in way to display the form in two columns, however you can split it into two "sections" and make it appear as two columns with CSS.
Here is an example from the PayPal module: PHP Code:
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|