Welcome to the nuBuilder Forums!

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

manipulation between main form and iframe

Questions related to using nuBuilder Forte.
joecocs
Posts: 67
Joined: Wed Jul 04, 2018 4:11 pm
Location: France

manipulation between main form and iframe

Unread post by joecocs »

Hello,

I created this topic because I am trying to find how to retrieve field values ​​from a subform or an iFrame to update a field in the main form. :?

I can update fields in subforms or iframe but not the other way around ...

If you are an idea ;)
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: manipulation between main form and iframe

Unread post by kev1n »

You can access the fields in subforms with nuSubformObject()

https://wiki.nubuilder.cloud/ ... formObject

Similar to what is shown here:

https://forums.nubuilder.cloud/viewtopic. ... ect#p18455
joecocs
Posts: 67
Joined: Wed Jul 04, 2018 4:11 pm
Location: France

Re: manipulation between main form and iframe

Unread post by joecocs »

I just read the posts and the wiki,
I had already read them,
but it's a question of passing a field value from a 'mainForm' to a 'subForm'.
I do it well and in several ways. ;)

In the wiki it says that with :
object = nuSubformObject(string1) ,
string1 : Subform Object id **Passing an empty string will return the main Edit Form as a Subform object.

but when I test it doesn't work. :cry:

I want to pass the value of a field contained in a 'subForm' to a field contained in a 'mainForm', like this :
Capture d’écran 2020-02-12 à 15.50.13.png
I'm looking for a way to write it with a function or a command but I'm blocked because despite 3 days of reading, videos or wiki, I don't get the result unless I redo my way of working on my application... :evil:

I am not a confirmed developer in JScript, I already made code for web but there it is a little hard to integrate everything. To learn is pretty good as a solution but here I am a little frustrated :mrgreen:
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: manipulation between main form and iframe

Unread post by kev1n »

The picture isn't showing a subform but rather a form in a run object (right?). How did you add Tmp_Tiers to that browse form?
joecocs
Posts: 67
Joined: Wed Jul 04, 2018 4:11 pm
Location: France

Re: manipulation between main form and iframe

Unread post by joecocs »

Hi,
The picture isn't showing a subform but rather a form in a run object (right?)
Yes, i was wrong in my previous post
How did you add Tmp_Tiers to that browse form?
it is a temporary field that I have in the table 'Tbl_Dossier'. I wanted to use it to filter the second Run :: iframe

I tried to integrate the command 'nuRunFilter' but it seems that a parameter does not work or is not referenced.
when i test the following code, i can see 'alert' 1 and 2 but not 3.

Code: Select all

if(nuFormType() == 'edit') {
    
    alert("hello! 1");
    nuHide('Ref_Dossier');
    alert("hello! 2");
    nuFilterRun('Form_Gestion_Tiers',$("#Form_Gestion_Intervenants").contents().find("#Ref_Tiers_Intervenants").val());
    alert("hello! 3");
    
    if(nuIsNewRecord()){
        
            $('#Ref_Dossier_Intervenants')
            .val(parent.nuFORM.getCurrent().record_id)
            .change();
    }
    
}
In the console I get:
Capture d’écran 2020-02-13 à 09.14.40.png
Is this normal?
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: manipulation between main form and iframe

Unread post by kev1n »

For me It is very difficult to understand why it does not work.
Ideally you upload a dump of your database (or the relevant forms) or send it to me via email. (with privat data removed of course)

Or you can create a Minimal, Reproducible Example (https://stackoverflow.com/help/minimal- ... le-example) and upload it here.
joecocs
Posts: 67
Joined: Wed Jul 04, 2018 4:11 pm
Location: France

Re: manipulation between main form and iframe

Unread post by joecocs »

ok,
I understand, I will send you an email with a backup of my database.

there is no private data because I am in development.

How to send you an email please ?
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: manipulation between main form and iframe

Unread post by kev1n »

You can send it to this email address: (removed. Ask me, if you still want to send it...)
Last edited by kev1n on Fri Feb 14, 2020 3:04 pm, edited 1 time in total.
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: manipulation between main form and iframe

Unread post by admin »

joecocs,

Can you confirm - by trying in the browser's console (F12) that this is valid.

Code: Select all

$("#Form_Gestion_Intervenants").contents().find("#Ref_Tiers_Intervenants").val()
Or maybe try hardcoding the second parameter to a string.

Steven
joecocs
Posts: 67
Joined: Wed Jul 04, 2018 4:11 pm
Location: France

Re: manipulation between main form and iframe

Unread post by joecocs »

Steven,

yes I confirm that the returned value is the correct one with this :

Code: Select all

$("#Form_Gestion_Intervenants").contents().find("#Ref_Tiers_Intervenants").val()
you can specify your idea to try the hardcoding please

I tried to code with variables and functions.

The problem didn't just recover the value but to transmit it to the second Run :: iframe
Post Reply