Welcome to the nuBuilder Forums!

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

Refresh HTML object and rerun JavaScript on Form

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

Refresh HTML object and rerun JavaScript on Form

Unread post by oli »

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
BR,
Oli
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Refresh HTML object and rerun JavaScript on Form

Unread post by kev1n »

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());
oli
Posts: 118
Joined: Sat Mar 20, 2021 3:22 pm
Has thanked: 4 times

Re: Refresh HTML object and rerun JavaScript on Form

Unread post by oli »

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
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Refresh HTML object and rerun JavaScript on Form

Unread post by kev1n »

Does this work?

Code: Select all

nuHasNotBeenEdited();
nuGetBreadcrumb();
Post Reply