X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   General questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=66)
-   -   DatePicker input on my Form Field (https://forum.x-cart.com/showthread.php?t=76184)

Soptareanu @Alex 04-20-2018 02:16 AM

DatePicker input on my Form Field
 
1 Attachment(s)
Hello, I want that one of my input fields in form show a datepicker. I use this class when i define my field, but it doesn't work.

'date' => [
self::SCHEMA_CLASS => '\XLite\View\FormField\Inline\Input\Text\Date',
self::SCHEMA_LABEL => static::t('Date'),
self::SCHEMA_PLACEHOLDER => static::t('Date'),
self::SCHEMA_REQUIRED => true,
],

tony_sologubov 04-20-2018 04:26 AM

Re: DatePicker input on my Form Field
 
Hi Alex,

Try to use \XLite\View\FormModel\Type\DatepickerType as self::SCHEMA_CLASS.

Tony

Quote:

Originally Posted by Soptareanu @Alex
Hello, I want that one of my input fields in form show a datepicker. I use this class when i define my field, but it doesn't work.

'date' => [
self::SCHEMA_CLASS => '\XLite\View\FormField\Inline\Input\Text\Date',
self::SCHEMA_LABEL => static::t('Date'),
self::SCHEMA_PLACEHOLDER => static::t('Date'),
self::SCHEMA_REQUIRED => true,
],


Soptareanu @Alex 04-20-2018 05:06 AM

Re: DatePicker input on my Form Field
 
If i use \XLite\View\FormModel\Type\DatepickerType, I get this error :
Call to undefined method XLite\View\FormModel\Type\DatepickerType::checkVis ibility()

tony_sologubov 04-20-2018 05:23 AM

Re: DatePicker input on my Form Field
 
Quote:

Originally Posted by Soptareanu @Alex
If i use \XLite\View\FormModel\Type\DatepickerType, I get this error :
Call to undefined method XLite\View\FormModel\Type\DatepickerType::checkVis ibility()


Could you please send the full error message with backtrace?
You might need to look it up in X-Cart logs.

Tony

Soptareanu @Alex 04-20-2018 05:31 AM

Re: DatePicker input on my Form Field
 
[20-Apr-2018 12:45:36] Error (code: 0): Call to protected method XLite\View\FormModel\Type\DatepickerType::checkVis ibility() from context 'XLite\View\Model\AModel'
Server API: cgi-fcgi;
Request method: GET;
URI: /?target=return_form;

qualiteam 04-23-2018 12:47 AM

Re: DatePicker input on my Form Field
 
Try this:
PHP Code:

'date' => array(
            
self::SCHEMA_CLASS    => 'XLite\View\DatePicker',
            
self::SCHEMA_LABEL => static::t('Date'),
            
self::SCHEMA_REQUIRED => false,
            
self::SCHEMA_PLACEHOLDER => static::t('Date'),
            \
XLite\View\FormField\AFormField::PARAM_FIELD_ONLY => false,
        ), 


Soptareanu @Alex 04-23-2018 07:16 AM

Re: DatePicker input on my Form Field
 
It return me this exception :
Unable to find template "form_field/datepicker.twig" (looked into: /storage/web/ecarnaval/public_html/skins/crisp_white/customer, /storage/web/ecarnaval/public_html/skins/custom_skin/customer, /storage/web/ecarnaval/public_html/skins/customer, /storage/web/ecarnaval/public_html/skins/common) in "form_field/form_field.twig" at line 20.

tony_sologubov 04-24-2018 04:09 AM

Re: DatePicker input on my Form Field
 
@Alex,

Yes, datepicker widget is not designed to work in customer area, only in admin back-end.
If you want to make it working in customer zone, you need to create your own version of this class.

Basic plan should be as follows:
- Extend\XLite\View\DatePicker class in your module;
- Define your own versions of getJSFiles(), getCSSFiles() and getFieldTemplate() methods, so that they would use files from customer area;
- Use your class in your ItemsList.

Soptareanu @Alex 04-24-2018 04:59 AM

Re: DatePicker input on my Form Field
 
Quote:

Originally Posted by tony_sologubov
@Alex,

Yes, datepicker widget is not designed to work in customer area, only in admin back-end.
If you want to make it working in customer zone, you need to create your own version of this class.

Basic plan should be as follows:
- Extend\XLite\View\DatePicker class in your module;
- Define your own versions of getJSFiles(), getCSSFiles() and getFieldTemplate() methods, so that they would use files from customer area;
- Use your class in your ItemsList.


Ok. I try to create my own class.

Soptareanu @Alex 04-24-2018 06:21 AM

Re: DatePicker input on my Form Field
 
1 Attachment(s)
Quote:

Originally Posted by Soptareanu @Alex
Ok. I try to create my own class.


My custom class render in my view such this result as in capture. What is wrong ?

This is my schemaDefault :
'date' => [
self::SCHEMA_CLASS => '\XLite\Module\Fdmteam\Xretur\View\FormField\Input \Text\DatePicker',
self::SCHEMA_LABEL => static::t('Date'),
self::SCHEMA_PLACEHOLDER => static::t('Date'),
self::SCHEMA_REQUIRED => true,
],


All times are GMT -8. The time now is 12:47 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.