Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

DatePicker input on my Form Field

 
Reply
   X-Cart forums > X-Cart 5 > General questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 04-20-2018, 02:16 AM
 
Soptareanu @Alex Soptareanu @Alex is offline
 

Advanced Member
  
Join Date: Apr 2018
Posts: 39
 

Default DatePicker input on my Form Field

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,
],
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	450
Size:	19.5 KB
ID:	5131  
__________________
Soptareanu Alex
Reply With Quote
  #2  
Old 04-20-2018, 04:26 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default 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,
],
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #3  
Old 04-20-2018, 05:06 AM
 
Soptareanu @Alex Soptareanu @Alex is offline
 

Advanced Member
  
Join Date: Apr 2018
Posts: 39
 

Default 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()
__________________
Soptareanu Alex
Reply With Quote
  #4  
Old 04-20-2018, 05:23 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default 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
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #5  
Old 04-20-2018, 05:31 AM
 
Soptareanu @Alex Soptareanu @Alex is offline
 

Advanced Member
  
Join Date: Apr 2018
Posts: 39
 

Default 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;
__________________
Soptareanu Alex
Reply With Quote
  #6  
Old 04-23-2018, 12:47 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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,
        ), 
__________________
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
Reply With Quote
  #7  
Old 04-23-2018, 07:16 AM
 
Soptareanu @Alex Soptareanu @Alex is offline
 

Advanced Member
  
Join Date: Apr 2018
Posts: 39
 

Default 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.
__________________
Soptareanu Alex
Reply With Quote
  #8  
Old 04-24-2018, 04:09 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default 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.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote

The following user thanks tony_sologubov for this useful post:
Soptareanu @Alex (04-24-2018)
  #9  
Old 04-24-2018, 04:59 AM
 
Soptareanu @Alex Soptareanu @Alex is offline
 

Advanced Member
  
Join Date: Apr 2018
Posts: 39
 

Default 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
Reply With Quote
  #10  
Old 04-24-2018, 06:21 AM
 
Soptareanu @Alex Soptareanu @Alex is offline
 

Advanced Member
  
Join Date: Apr 2018
Posts: 39
 

Default Re: DatePicker input on my Form Field

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,
],
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	454
Size:	25.6 KB
ID:	5132  
__________________
Soptareanu Alex
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > General questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:18 AM.

   

 
X-Cart forums © 2001-2020