# I want to use datepicker to save the day as text.

**URL:** <https://forum.wixstudio.com/t/i-want-to-use-datepicker-to-save-the-day-as-text/10443>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [September 6, 2021, 3:31am UTC](https://forum.wixstudio.com/t/i-want-to-use-datepicker-to-save-the-day-as-text/10443 "2021-09-06T03:31:58Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![nanami](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/nanami/32/1875_2.png) [@nanami](https://forum.wixstudio.com/u/nanami)\
**Post date:** [September 14, 2021, 5:56am UTC](https://forum.wixstudio.com/t/i-want-to-use-datepicker-to-save-the-day-as-text/10443/21 "2021-09-14T05:56:27Z")

</div>

@yisrael-wix Thank your for your replay.  
I don’t use repeater on this page.  
This page is dynamic page.  
Is it still the same?

---

<div class="post-metadata">

**Author:** ![yisrael-wix](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/yisrael-wix/32/1107_2.png) [@yisrael-wix](https://forum.wixstudio.com/u/yisrael-wix)\
**Post date:** [September 14, 2021, 6:20am UTC](https://forum.wixstudio.com/t/i-want-to-use-datepicker-to-save-the-day-as-text/10443/22 "2021-09-14T06:20:29Z")

</div>

@nanami Your code has a Repeater onItemReady():

```javascript
$w("#repeater5").onItemReady(($w,itemData,index)=>{

```

---

<div class="post-metadata">

**Author:** ![nanami](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/nanami/32/1875_2.png) [@nanami](https://forum.wixstudio.com/u/nanami)\
**Post date:** [September 14, 2021, 7:23am UTC](https://forum.wixstudio.com/t/i-want-to-use-datepicker-to-save-the-day-as-text/10443/23 "2021-09-14T07:23:21Z")

</div>

@yisrael-wix  
The repeater is the code to open the lightbox.  
This one is working fine.

the datapicker has nothing to do with repeaters and lightboxes, but wants to connect with different database.

**import** wixWindow **from** ‘wix-window’ ;

**const** options = { weekday : ‘long’ , year : ‘numeric’ , month : ‘long’ , day : ‘numeric’ };

$w . onReady (() =\> {  
$w ( “#repeater5” ). onItemReady (( $w , itemData , index ) =\> {  
$w ( “#image272” ). onClick (() =\> {  
**const** repeaterItem = itemData ;  
wixWindow . openLightbox ( “lightbox” , repeaterItem );  
});

$w ( ‘#dynamicDataset’ ). onReady (() =\> {

```
  $w ( "#dynamicDataset" ). onBeforeSave ( () => { 

     $w ( '#dynamicDataset' ). setFieldValues ({ 
date : $w ( '#datePicker1' ). value . toLocaleDateString ( 'ja-JP' , options ) 

```

})

console . log ( “Canceling save” );  
**return**** false** ;  
} );

```
}) 
}); 
})

```

---

<div class="post-metadata">

**Author:** ![nanami](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/nanami/32/1875_2.png) [@nanami](https://forum.wixstudio.com/u/nanami)\
**Post date:** [September 14, 2021, 7:33am UTC](https://forum.wixstudio.com/t/i-want-to-use-datepicker-to-save-the-day-as-text/10443/24 "2021-09-14T07:33:50Z")

</div>

@ahmadnasriya  
I tried delete the return line.  
but the code getting an error.  
so I change the code false → true  
but nothing save in the date field.

the code is

**import** wixWindow **from** ‘wix-window’ ;

**const** options = { weekday : ‘long’ , year : ‘numeric’ , month : ‘long’ , day : ‘numeric’ };

$w . onReady (() =\> {  
$w ( “#repeater5” ). onItemReady (( $w , itemData , index ) =\> {  
$w ( “#image272” ). onClick (() =\> {  
**const** repeaterItem = itemData ;  
wixWindow . openLightbox ( “lightbox” , repeaterItem );  
});

$w ( ‘#dynamicDataset’ ). onReady (() =\> {

```
  $w ( "#dynamicDataset" ). onBeforeSave ( () => { 

     $w ( '#dynamicDataset' ). setFieldValues ({ 
date : $w ( '#datePicker1' ). value . toLocaleDateString ( 'ja-JP' , options ) 

```

})

console . log ( “Canceling save” );  
**return**** true** ;  
} );

```
}) 
}); 
})

```

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [September 14, 2021, 10:49am UTC](https://forum.wixstudio.com/t/i-want-to-use-datepicker-to-save-the-day-as-text/10443/25 "2021-09-14T10:49:52Z")

</div>

@nanami  
IT’s–\> nanami ← again, who makes that much trouble 😅

---

<div class="post-metadata">

**Author:** ![anon72313111](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@anon72313111](https://forum.wixstudio.com/u/anon72313111)\
**Post date:** [September 14, 2021, 4:56pm UTC](https://forum.wixstudio.com/t/i-want-to-use-datepicker-to-save-the-day-as-text/10443/26 "2021-09-14T16:56:01Z")

</div>

@nanami you should not return anything.

---

<div class="post-metadata">

**Author:** ![nanami](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/nanami/32/1875_2.png) [@nanami](https://forum.wixstudio.com/u/nanami)\
**Post date:** [September 15, 2021, 5:35pm UTC](https://forum.wixstudio.com/t/i-want-to-use-datepicker-to-save-the-day-as-text/10443/27 "2021-09-15T17:35:46Z")

</div>

@ahmadnasriya  
If I don’t put anything in the return, I get an error.

---

<div class="post-metadata">

**Author:** ![anon72313111](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@anon72313111](https://forum.wixstudio.com/u/anon72313111)\
**Post date:** [September 18, 2021, 5:45am UTC](https://forum.wixstudio.com/t/i-want-to-use-datepicker-to-save-the-day-as-text/10443/28 "2021-09-18T05:45:56Z")

</div>

@nanami What’s the error you’re getting?

[Previous page](https://forum.wixstudio.com/t/i-want-to-use-datepicker-to-save-the-day-as-text/10443.md?page=1)
