Welcome to the nuBuilder Forums!

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

Overlapping Elements in Iframe Edit Form

Questions related to using nuBuilder Forte.
yvesf
Posts: 315
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 87 times
Been thanked: 11 times

Overlapping Elements in Iframe Edit Form

Unread post by yvesf »

Hi,

I have a browse and edit form within an iframe filtered by date. When I try to create a new record, the interface behaves unexpectedly.
Video_2025-01-21_211457.gif
Many thanks for your recommandation to solve this issue.

Yves
You do not have the required permissions to view the files attached to this post.
steven
Posts: 369
Joined: Mon Jun 15, 2009 10:03 am
Has thanked: 52 times
Been thanked: 52 times

Re: Overlapping Elements in Iframe Edit Form

Unread post by steven »

Hi yvesf,

Can you upload a copy, so we can take a look?


Steven
A short post is a good post.
yvesf
Posts: 315
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 87 times
Been thanked: 11 times

Re: Overlapping Elements in Iframe Edit Form

Unread post by yvesf »

Here it is -->
01-21-2025_202611_679010f36a5dc_nuBuilder_backup.sql.gzip
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Overlapping Elements in Iframe Edit Form

Unread post by kev1n »

Hi Yves,

It seems that the issue is caused by nuFilterRun(). When I remove or exclude it, the functionality works as expected.
As a workaround, you could add the following WHERE clause to the iframe SQL to display today’s data by default:

Code: Select all

WHERE CAST(rdv_date AS DATE) = CURDATE()
For filtering, you can set a hash cookie containing a different date and then refresh the iframe accordingly. If you’re unsure how to implement this, I’d be happy to provide an example.

Additionally, it’s important not to declare variables using let or const directly in the Custom Code of the form. If the form is reloaded, these variables will still exist and can cause errors. To avoid this, you can refactor the code into separate functions where let and const can be safely used, or you can use var directly in the form’s Custom Code.

Also, It’s important to note that `nuuserhome` is a core form in nuBuilder, and no custom code should be added to it, as it will be overwritten when nuBuilder is updated. However, perhaps you only used it for your upload sample.
yvesf
Posts: 315
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 87 times
Been thanked: 11 times

Re: Overlapping Elements in Iframe Edit Form

Unread post by yvesf »

Hi Kev1n,

Thank you for your valuable feedback—it’s much appreciated!

I’ve been working on building an agenda in nuBuilder and initially considered using the nufilterrun function with the following approach:

- I have a browse list, which displays the full list of tasks, regardless of the date, sorted by date.
My idea was to create an iframe that filters tasks dynamically based on a date field at the top of the page. I have seen a lot of videos pushing this approach.
However, I now understand that using nufilterrun may not be the best approach, as it can cause UI rendering issues.
I understand that a better solution would be to use hash cookies. If possible, could you provide an example or further explanation of how to implement this method?

On another point, I appreciate your remark about customizing nuUserHome. I’ve applied this customization to each of my apps. However, before proceeding with any upgrades, I understand it’s better to create a dedicated launch form instead.

Thanks again for your continued help and support!

Yves
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Overlapping Elements in Iframe Edit Form

Unread post by kev1n »

iframe WHERE:

Code: Select all

WHERE
    (
        '#filter_date#' = '' OR '#filter_date#' = '#' OR CAST('#filter_date#' AS DATE) IS NULL
    )
    AND CAST(rdv_date AS DATE) = CURDATE()
    OR (
        LENGTH('#filter_date#') = 10 
        AND CAST('#filter_date#' AS DATE) IS NOT NULL 
        AND CAST(rdv_date AS DATE) = CAST('#filter_date#' AS DATE)
    );
(if no filter is set, use the current date as default)

And for "Date Accueil", I added an onchange event that calls a function refreshRDViFrame(); that is declared in the main form's Custom Code:

Code: Select all

function refreshRDViFrame() {

    let $accDate = $('#acc_date');
    let filterDate = nuFORM.removeFormatting($accDate.val(), $accDate.attr('data-nu-format'));

    const iframeRDV = $("#RDV_iframe")[0].contentWindow;
    iframeRDV.nuSetProperty('filter_date', filterDate);
    iframeRDV.nuGetBreadcrumb();

}
Similarly, a filter condition can be applied to the "acc_praticien" field.
yvesf
Posts: 315
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 87 times
Been thanked: 11 times

Re: Overlapping Elements in Iframe Edit Form

Unread post by yvesf »

Hi Kevin,

I have the following error "Uncaught TypeError: Cannot read properties of undefined (reading 'contentWindow')".
It seems that the iframe's contentWindow is not accessible.
Thx for your help,

Yves
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Overlapping Elements in Iframe Edit Form

Unread post by kev1n »

Replace "RDV_iframe" with the obj ID of your iframe if it is different.
yvesf
Posts: 315
Joined: Sun Mar 14, 2021 8:48 am
Location: Geneva
Has thanked: 87 times
Been thanked: 11 times

Re: Overlapping Elements in Iframe Edit Form

Unread post by yvesf »

solved but not filtering the view

Yves
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Overlapping Elements in Iframe Edit Form

Unread post by kev1n »

Please upload the db again.
Post Reply