Hi all,
I have 3 iframes opening the same browse/edit form.
There are 3 DISPLAY*** objects which run an SQL to show the statistic.
However it seems to be wrong and all showing the same result.
The variable is called #Project# is a cookie seems to be shared among all 3 iframes.
How do I separate into 3 different cookies, or otherwise?
Edit: *** sorry it's DISPLAY object, not SELECT object.
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.
3 Iframes with different cookies
-
- Posts: 51
- Joined: Sat May 16, 2020 10:08 am
3 Iframes with different cookies
You do not have the required permissions to view the files attached to this post.
Last edited by ernesttan1976 on Mon Oct 12, 2020 8:27 am, edited 1 time in total.
-
- nuBuilder Team
- Posts: 4299
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: 3 Iframes with different cookies
Retrieve the corresponding project in your getEmployeeInfo() function.
In your PHP procedure, use the hash cookie #project# to retrieve the project.
PS: I presume that your questions is related to the other topic: https://forums.nubuilder.cloud/viewtopic.php?f=20&t=10580
Code: Select all
function getEmployeeInfo(event) {
var empId = $('#' + event.target.id).val();
nuSetProperty('empId', empId);
var prefix = $(event.target).attr('data-nu-prefix');
nuSetProperty('prefix', prefix);
var project = $(event.target).parent().find('#' + 'project').val(); // ----> replace 'project' with your project object ID
nuSetProperty('project', project);
nuRunPHPHidden('getEmployeeInfo', 0)
}
In your PHP procedure, use the hash cookie #project# to retrieve the project.
PS: I presume that your questions is related to the other topic: https://forums.nubuilder.cloud/viewtopic.php?f=20&t=10580
-
- Posts: 51
- Joined: Sat May 16, 2020 10:08 am
Re: 3 Iframes with different cookies
HI Kevin,
Sorry I was not clear.
What I mean is the Active Deployed Display Object uses an SQL like so.
SELECT Count(ActiveDeployed) FROM project_assignment WHERE project_code = '#project#'
#project# is the cookie which will be set when loading the project field.
When I refresh, the display object should show 3 different sets of statistics. but it shows as if there is only 1 cookie.
Sorry I was not clear.
What I mean is the Active Deployed Display Object uses an SQL like so.
SELECT Count(ActiveDeployed) FROM project_assignment WHERE project_code = '#project#'
#project# is the cookie which will be set when loading the project field.
When I refresh, the display object should show 3 different sets of statistics. but it shows as if there is only 1 cookie.
-
- nuBuilder Team
- Posts: 4299
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: 3 Iframes with different cookies
This seems to be a nuBuilder limitation. The hash cookie #project# exists only once for all 3 iframes.
And right now I can't think of an elegant solution. Maybe someone else?
And right now I can't think of an elegant solution. Maybe someone else?
-
- nuBuilder Team
- Posts: 506
- Joined: Fri Dec 28, 2018 1:41 pm
- Location: Krakow, Poland
- Has thanked: 8 times
- Been thanked: 18 times
Re: 3 Iframes with different cookies
Hi,
I just did similar try with 3 identical forms in the iframes on the same edit form - and did not observe any issue.
The hash cookies are separated between iframes.
Initially you can try to display hash cookie only like:
SELECT '#project#'
maybe there are some name conflicts, or ...
I just did similar try with 3 identical forms in the iframes on the same edit form - and did not observe any issue.
The hash cookies are separated between iframes.
Initially you can try to display hash cookie only like:
SELECT '#project#'
maybe there are some name conflicts, or ...
If you like nuBuilder, please leave a review on SourceForge
-
- nuBuilder Team
- Posts: 506
- Joined: Fri Dec 28, 2018 1:41 pm
- Location: Krakow, Poland
- Has thanked: 8 times
- Been thanked: 18 times
Re: 3 Iframes with different cookies
and short movie
https://drive.google.com/file/d/1iywjkl ... sp=sharing
https://drive.google.com/file/d/1iywjkl ... sp=sharing
If you like nuBuilder, please leave a review on SourceForge
-
- nuBuilder Team
- Posts: 4299
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: 3 Iframes with different cookies
Does the issue only occur when you refresh the form?ernesttan1976 wrote:When I refresh, the display object should show 3 different sets of statistics. but it shows as if there is only 1 cookie.
-
- Posts: 51
- Joined: Sat May 16, 2020 10:08 am
Re: 3 Iframes with different cookies
Hi Kevin and Janusz,
Thank you for your great help.
From Janus' answer, Nubuilder is able to support multiple instances of the same iframe form with its cookies, even with the same name.
So I went back and realized I have 1 cookie on the launch form with 'Project' and another cookie on the iframe with 'Project'. that's why it conflicted.
My bad!
I changed the iframe cookie to 'Project2' and it worked!
Thanks guys!
Thank you for your great help.
From Janus' answer, Nubuilder is able to support multiple instances of the same iframe form with its cookies, even with the same name.
So I went back and realized I have 1 cookie on the launch form with 'Project' and another cookie on the iframe with 'Project'. that's why it conflicted.
My bad!
I changed the iframe cookie to 'Project2' and it worked!
Thanks guys!
You do not have the required permissions to view the files attached to this post.