Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Calendar pop-up doesn't work on Input field Topic is solved

Questions related to using nuBuilder Forte.
Post Reply
oli
Posts: 118
Joined: Sat Mar 20, 2021 3:22 pm
Has thanked: 4 times

Calendar pop-up doesn't work on Input field

Unread post by oli »

Hello,
I'm using an Input field (datetime-local).
In order to change the weekday in another field I've added following custom code (oninput).
Unfortunately it's not possible to select the date / time per calendar pop-up anymore - it's only possible to fill in the date and time directly into the field.

Does anyone know how to change the custom code to enable the calendar pop-up widget again?

Thanks in adavance
BR, Oli

Code: Select all

if(nuIsNewRecord()){
    // Set Value in field kal_saison
    var startdatum = $("#kal_startzeit").val();
    var monat = startdatum.substr(5, 2);
    var jahr = startdatum.substr(0, 4);
    
    if(monat>7){
        var saison = jahr + "/" + parseInt(parseInt(jahr) + 1);
    }else{
        var saison = parseInt(parseInt(jahr) - 1) + "/" + jahr;
    }
    
    $('#kal_saison').val(saison).change();
}

// Get the day of the week based on the selected date
var startzeit = $("#kal_startzeit").val();
wochentag = new Array("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag");
var day = new Date(startzeit).getDay();
var tag = wochentag[day];
$('#kal_wochentag').val(tag).change();     

// Set field kal_endezeit based on kal_startzeit
$('#kal_endezeit').val(startzeit).change();
kev1n
nuBuilder Team
Posts: 4416
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 472 times
Contact:

Re: Calendar pop-up doesn't work on Input field

Unread post by kev1n »

Hi,

Should the calendar pop up for kal_endezeit ?

And is this code relevant for your question?

Code: Select all

if(nuIsNewRecord()){
    // Set Value in field kal_saison
    var startdatum = $("#kal_startzeit").val();
    var monat = startdatum.substr(5, 2);
    var jahr = startdatum.substr(0, 4);
    
    if(monat>7){
        var saison = jahr + "/" + parseInt(parseInt(jahr) + 1);
    }else{
        var saison = parseInt(parseInt(jahr) - 1) + "/" + jahr;
    }
    
    $('#kal_saison').val(saison).change();
}
Could you also upload a screenshot of your object that shows what the format of the value looks like?
oli
Posts: 118
Joined: Sat Mar 20, 2021 3:22 pm
Has thanked: 4 times

Re: Calendar pop-up doesn't work on Input field

Unread post by oli »

Hi Kev1n,

kal_endezeit works fine and I can use the calendar pop-up on this field.

The problem occurs on the field kal_startzeit (Label: Startzeit). Whenever I want to use the calendar pop-up the focus jumps to the field kal_wochentag (Label: Wochentag) and no pop-up appears.
screenshot_1.jpg
The posted code is the custom code of the field kal_startzeit and this code is causing the issue.
Because I try to set the value of the correct day of the week in the field kal_wochentag based on the selected date of the field kal_startzeit.
I guess that this part of the code is triggering the change of the focus to the field kal_wochentag and prevents the calendar pop-up.
kal_startzeit_custom-code.jpg
kal_startzeit.jpg
Was this information helpful to understand the problem?
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4416
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 472 times
Contact:

Re: Calendar pop-up doesn't work on Input field

Unread post by kev1n »

I don't seem to be able to replicate this issue on my side.

https://test.nubuilder.cloud/
User Home -> Datepicker Test
oli
Posts: 118
Joined: Sat Mar 20, 2021 3:22 pm
Has thanked: 4 times

Re: Calendar pop-up doesn't work on Input field

Unread post by oli »

Thank you Kev1n.

It was no issue with the code but the field "Wochentag" was too close to the field "Starttag".
It seems that there was an overlapping of both fields in the background and the calendar icon partially lies over the field "wochentag".
After moving "Wochentag" a few pixels everything worked fine.

Thanks a lot!
hering
Posts: 10
Joined: Sun Apr 09, 2023 12:54 pm
Has thanked: 8 times
Been thanked: 1 time

Re: Calendar pop-up doesn't work on Input field

Unread post by hering »

Hello,
How can I do something like this but with nuDate (Data Type: date)?
With Datetime-Local works great but with nuDate doesn't.
I try nuDate with yyyy-mm-dd, dddd format. Looks fine with first set but works terrible if try to change date and Your way has more potential.

Have a nice day.
Post Reply