[Skip to main content](#vessel-content)

#   Custom field date pickers allow dates problem

##

- **[insitevision](/forum/user/35045-insitevision "View insitevision's Profile")**
- [![insitevision's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/35045-insitevision "View insitevision's Profile") Topic Author
- [ Offline](/forum/user/35045-insitevision)

Less More

- Posts: 14
- Thank you received: 0
-
-

7 years 9 months ago [\#303894](#303894) by [insitevision](/forum/user/35045-insitevision "View insitevision's Profile")  *[Custom field date pickers allow dates problem](/forum/27-checkout/896925-custom-field-date-pickers-allow-dates-problem#303894 "-- HikaShop version -- : 4.0.2 -- Joomla version -- : 3.9.3 -- PHP version -- : 7.2.14 -- Browser(s) name and version -- : FireFox 65.0.1  Hi,  During checkout there must be a choice for promotional material. So I configured a radio (table order) for no (standard, value 0) or yes (value 1). Based on this choice 2 (advanced) datepickers (also in table order) appear (from which date and till which date). De first datepicker should only allow future days, the second datepicker should only allow dates starting datepicker 1 till 7 days later.  I'm no coder but, with Jquery, I have the datepickers working. There is only 1 problem: The first datepickers input is not saved to the database. When choosing Hikashop -&gt; Orders the Radio and datepicker colluns are visible but the first datepicker shows blank, even if a date is entered during checkout.  My jQuery code:  Any idea why the input from the first datepicker is not saved (see attached image where the &quot;Van&quot; value is not visible)? When I remove the above code all values are saved including the first datepicker. So something in the code prevents the first datapicker from saving but I have no clue (due to too little coding knowledge).  Kind regards, Eric Beernink")* was created by *[insitevision](/forum/user/35045-insitevision "View insitevision's Profile")*

-- HikaShop version -- : 4.0.2
-- Joomla version -- : 3.9.3
-- PHP version -- : 7.2.14
-- Browser(s) name and version -- : FireFox 65.0.1

Hi,

During checkout there must be a choice for promotional material. So I configured a radio (table order) for no (standard, value 0) or yes (value 1). Based on this choice 2 (advanced) datepickers (also in table order) appear (from which date and till which date). De first datepicker should only allow future days, the second datepicker should only allow dates starting datepicker 1 till 7 days later.

I'm no coder but, with Jquery, I have the datepickers working. There is only 1 problem: The first datepickers input is not saved to the database. When choosing Hikashop -&gt; Orders the Radio and datepicker colluns are visible but the first datepicker shows blank, even if a date is entered during checkout.

My jQuery code:
Code:

jQuery(document).ready(function($) { var $div1 = $('#hikashop_order_1_7_promotiebanner_van'); var $div2 = $('#hikashop_order_1_7_promotiebanner_tot'); $div1.hide(); $div2.hide(); $('input:radio[name="checkout[fields][promotiebanner]"]').change(function() { if (this.checked) { if (this.value == '1') { $div1.show(); $div2.show(); } else { $div1.hide(); $div2.hide(); $('#promotiebanner_van_input').val(''); $('#promotiebanner_tot_input').val(''); } } }); $("#promotiebanner_van_input").datepicker({ minDate: 0, onSelect: function() { var begin = $(this).datepicker('getDate'); var eind = $(this).datepicker('getDate'); eind.setDate(eind.getDate() + 7); begin.setDate(begin.getDate() + 2); $('#promotiebanner_tot_input').datepicker('option', 'minDate', begin); $('#promotiebanner_tot_input').datepicker('option', 'maxDate', eind); } }); });

Any idea why the input from the first datepicker is not saved (see attached image where the "Van" value is not visible)?
When I remove the above code all values are saved including the first datepicker. So something in the code prevents the first datapicker from saving but I have no clue (due to too little coding knowledge).

Kind regards,
Eric Beernink

- [ ![missing&#95;value.png](/forum/attachment/46129) ](/forum/attachment/46129 "missing&#95;value.png") [ ](/forum/attachment/46129?download=1 "missing&#95;value.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5NjkyNS1jdXN0b20tZmllbGQtZGF0ZS1waWNrZXJzLWFsbG93LWRhdGVzLXByb2JsZW0/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14325
-
-

7 years 9 months ago [\#303895](#303895) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Custom field date pickers allow dates problem](/forum/27-checkout/896925-custom-field-date-pickers-allow-dates-problem#303895 "-- HikaShop version -- : 4.0.2 -- Joomla version -- : 3.9.3 -- PHP version -- : 7.2.14 -- Browser(s) name and version -- : FireFox 65.0.1  Hi,  During checkout there must be a choice for promotional material. So I configured a radio (table order) for no (standard, value 0) or yes (value 1). Based on this choice 2 (advanced) datepickers (also in table order) appear (from which date and till which date). De first datepicker should only allow future days, the second datepicker should only allow dates starting datepicker 1 till 7 days later.  I'm no coder but, with Jquery, I have the datepickers working. There is only 1 problem: The first datepickers input is not saved to the database. When choosing Hikashop -&gt; Orders the Radio and datepicker colluns are visible but the first datepicker shows blank, even if a date is entered during checkout.  My jQuery code:  Any idea why the input from the first datepicker is not saved (see attached image where the &quot;Van&quot; value is not visible)? When I remove the above code all values are saved including the first datepicker. So something in the code prevents the first datapicker from saving but I have no clue (due to too little coding knowledge).  Kind regards, Eric Beernink")*

Hi,

Hard to say. I would need to look at the behaviour directly on the page to be able to analyze the situation more in depth.
I went to your link but there are no add to cart buttons on your products so I can't access the checkout to see your custom fields.
Could you provide precise instructions to reproduce the problem on your website please ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5NjkyNS1jdXN0b20tZmllbGQtZGF0ZS1waWNrZXJzLWFsbG93LWRhdGVzLXByb2JsZW0/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[insitevision](/forum/user/35045-insitevision "View insitevision's Profile")**
- [![insitevision's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/35045-insitevision "View insitevision's Profile") Topic Author
- [ Offline](/forum/user/35045-insitevision)

Less More

- Posts: 14
- Thank you received: 0
-
-

7 years 9 months ago [\#303913](#303913) by [insitevision](/forum/user/35045-insitevision "View insitevision's Profile")  Replied by *[insitevision](/forum/user/35045-insitevision "View insitevision's Profile")* on topic *[Custom field date pickers allow dates problem](/forum/27-checkout/896925-custom-field-date-pickers-allow-dates-problem#303913 "-- HikaShop version -- : 4.0.2 -- Joomla version -- : 3.9.3 -- PHP version -- : 7.2.14 -- Browser(s) name and version -- : FireFox 65.0.1  Hi,  During checkout there must be a choice for promotional material. So I configured a radio (table order) for no (standard, value 0) or yes (value 1). Based on this choice 2 (advanced) datepickers (also in table order) appear (from which date and till which date). De first datepicker should only allow future days, the second datepicker should only allow dates starting datepicker 1 till 7 days later.  I'm no coder but, with Jquery, I have the datepickers working. There is only 1 problem: The first datepickers input is not saved to the database. When choosing Hikashop -&gt; Orders the Radio and datepicker colluns are visible but the first datepicker shows blank, even if a date is entered during checkout.  My jQuery code:  Any idea why the input from the first datepicker is not saved (see attached image where the &quot;Van&quot; value is not visible)? When I remove the above code all values are saved including the first datepicker. So something in the code prevents the first datapicker from saving but I have no clue (due to too little coding knowledge).  Kind regards, Eric Beernink")*

Hi Nicolas,

It's a B2B site (in development) so you need credentials to logon (guests only see a catalog).
You can logon (menu-item aanmelden) with

This message contains confidential information

Then goto cart (winkelwagentje) and then checkout. At the bottom there is a radio which triggers the 2 datepickers.

This message contains confidential information

Regards,
Eric

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5NjkyNS1jdXN0b20tZmllbGQtZGF0ZS1waWNrZXJzLWFsbG93LWRhdGVzLXByb2JsZW0/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14325
-
-

7 years 9 months ago [\#303926](#303926) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Custom field date pickers allow dates problem](/forum/27-checkout/896925-custom-field-date-pickers-allow-dates-problem#303926 "-- HikaShop version -- : 4.0.2 -- Joomla version -- : 3.9.3 -- PHP version -- : 7.2.14 -- Browser(s) name and version -- : FireFox 65.0.1  Hi,  During checkout there must be a choice for promotional material. So I configured a radio (table order) for no (standard, value 0) or yes (value 1). Based on this choice 2 (advanced) datepickers (also in table order) appear (from which date and till which date). De first datepicker should only allow future days, the second datepicker should only allow dates starting datepicker 1 till 7 days later.  I'm no coder but, with Jquery, I have the datepickers working. There is only 1 problem: The first datepickers input is not saved to the database. When choosing Hikashop -&gt; Orders the Radio and datepicker colluns are visible but the first datepicker shows blank, even if a date is entered during checkout.  My jQuery code:  Any idea why the input from the first datepicker is not saved (see attached image where the &quot;Van&quot; value is not visible)? When I remove the above code all values are saved including the first datepicker. So something in the code prevents the first datapicker from saving but I have no clue (due to too little coding knowledge).  Kind regards, Eric Beernink")*

Hi,

From what I can see, the problem is that the hidden input field generated by the calendar is not being updated when something is selected in the calendar of the "van" custom field.
From what I understand, this is because you override the "select" function of the datepicker for that van custom field with the code: Code:

onSelect: function() { var begin = $(this).datepicker('getDate'); var eind = $(this).datepicker('getDate'); eind.setDate(eind.getDate() + 7); begin.setDate(begin.getDate() + 2); $('#promotiebanner_tot_input').datepicker('option', 'minDate', begin); $('#promotiebanner_tot_input').datepicker('option', 'maxDate', eind); }

But you don't update the hidden input in that function. Apparently you'd have to do that yourself if you override that select function.
So, you'll want to also do something like that in there: Code:

$('#promotiebanner_van').value = $(this).datepicker('getDate');

Now please understand that this is something way out of normal HikaShop user support. If you need help with custom javascript development, I would recommend to seek help on stackoverflow, like I do when I'm working on development projects and need help with code.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5NjkyNS1jdXN0b20tZmllbGQtZGF0ZS1waWNrZXJzLWFsbG93LWRhdGVzLXByb2JsZW0/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[insitevision](/forum/user/35045-insitevision "View insitevision's Profile")**
- [![insitevision's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/35045-insitevision "View insitevision's Profile") Topic Author
- [ Offline](/forum/user/35045-insitevision)

Less More

- Posts: 14
- Thank you received: 0
-
-

7 years 9 months ago [\#303956](#303956) by [insitevision](/forum/user/35045-insitevision "View insitevision's Profile")  Replied by *[insitevision](/forum/user/35045-insitevision "View insitevision's Profile")* on topic *[Custom field date pickers allow dates problem](/forum/27-checkout/896925-custom-field-date-pickers-allow-dates-problem#303956 "-- HikaShop version -- : 4.0.2 -- Joomla version -- : 3.9.3 -- PHP version -- : 7.2.14 -- Browser(s) name and version -- : FireFox 65.0.1  Hi,  During checkout there must be a choice for promotional material. So I configured a radio (table order) for no (standard, value 0) or yes (value 1). Based on this choice 2 (advanced) datepickers (also in table order) appear (from which date and till which date). De first datepicker should only allow future days, the second datepicker should only allow dates starting datepicker 1 till 7 days later.  I'm no coder but, with Jquery, I have the datepickers working. There is only 1 problem: The first datepickers input is not saved to the database. When choosing Hikashop -&gt; Orders the Radio and datepicker colluns are visible but the first datepicker shows blank, even if a date is entered during checkout.  My jQuery code:  Any idea why the input from the first datepicker is not saved (see attached image where the &quot;Van&quot; value is not visible)? When I remove the above code all values are saved including the first datepicker. So something in the code prevents the first datapicker from saving but I have no clue (due to too little coding knowledge).  Kind regards, Eric Beernink")*

Hi Nicolas,

Thank you for your comment, I'll try to figure out to update the input in the hidden input.

Regards,
Eric

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5NjkyNS1jdXN0b20tZmllbGQtZGF0ZS1waWNrZXJzLWFsbG93LWRhdGVzLXByb2JsZW0/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.057 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
