Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Overlapping Elements in Iframe Edit Form
-
- 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
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. Many thanks for your recommandation to solve this issue.
Yves
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. 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.
Re: Overlapping Elements in Iframe Edit Form
Hi yvesf,
Can you upload a copy, so we can take a look?
Steven
Can you upload a copy, so we can take a look?
Steven
A short post is a good post.
-
- 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
Here it is -->
You do not have the required permissions to view the files attached to this post.
-
- 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
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:
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.
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()
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.
-
- 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
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
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
-
- 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
iframe WHERE:
(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:
Similarly, a filter condition can be applied to the "acc_praticien" field.
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)
);
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();
}
-
- 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
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
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
-
- 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
Replace "RDV_iframe" with the obj ID of your iframe if it is different.
-
- nuBuilder Team
- Posts: 4292
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 444 times
- Contact: