Refresh HTML object and rerun JavaScript on Form

Questions related to customising nuBuilder Forte with JavaScript or PHP.

Refresh HTML object and rerun JavaScript on Form

Unread postby oli » Tue May 18, 2021 12:13 am

Hi,

I need to create a calendar on a form:
Therefore I created a :
- new Form where the JavaScript is defined to create the calendar
- HTML Object (to show the calendar)
- Date Picker to select the month that should be displayed

I didn't find a way how to use the selected date from the Input object (Datum) and to refresh the calendar based on the selected month of the input object.

Is there a way to forward the selected date to the JavaScript and to re-build the calendar without storing the value of the input object in the database?

calendar.jpg
calendar.jpg (170.78 KiB) Viewed 298 times


BR,
Oli
oli
 
Posts: 77
Joined: Sat Mar 20, 2021 11:52 pm
nuBuilder Version: 4.5

Re: Refresh HTML object and rerun JavaScript on Form

Unread postby kev1n » Tue May 18, 2021 12:26 am

If you have a JS function where the calendar is created, call that by passing the date of the input.

e.g.:

Code: Select all
function createMyCalendar(date) {
  // ... code to create the calendar...
}



Call in the onchange event of your date input:

Code: Select all
createMyCalendar($('#your_date_object_id').val());
kev1n
nuBuilder Team
 
Posts: 2012
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Refresh HTML object and rerun JavaScript on Form

Unread postby oli » Tue May 18, 2021 7:37 pm

Thank you ... works great.

Now I have another issue.

I need to refresh the form once the date field was changed.
I tried using this in the onchange code of the date selector:
Code: Select all
nuGetBreadcrumb();

which is not working and I can't do any change on the form. Is there another possibility I could use therefore?

BR,
Oli
oli
 
Posts: 77
Joined: Sat Mar 20, 2021 11:52 pm
nuBuilder Version: 4.5

Re: Refresh HTML object and rerun JavaScript on Form

Unread postby kev1n » Tue May 18, 2021 8:56 pm

Does this work?

Code: Select all
nuHasNotBeenEdited();
nuGetBreadcrumb();
kev1n
nuBuilder Team
 
Posts: 2012
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5


Return to Custom Code

Who is online

Users browsing this forum: No registered users and 3 guests

cron