manipulation between main form and iframe

Questions related to using nuBuilder Forte.

manipulation between main form and iframe

Postby joecocs » Wed Feb 12, 2020 5:55 pm

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 ;)
joecocs
 
Posts: 30
Joined: Wed Jul 04, 2018 11:41 pm
Location: France

Re: manipulation between main form and iframe

Postby kev1n » Wed Feb 12, 2020 10:34 pm

You can access the fields in subforms with nuSubformObject()

https://wiki.nubuilder.net/nubuilderfor ... formObject

Similar to what is shown here:

viewtopic.php?f=20&t=9716&p=18455&hilit=nuSubformObject#p18455
kev1n
 
Posts: 474
Joined: Mon Oct 15, 2018 2:13 am

Re: manipulation between main form and iframe

Postby joecocs » Thu Feb 13, 2020 12:32 am

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
Like this
Capture d’écran 2020-02-12 à 15.50.13.png (61.86 KiB) Viewed 161 times


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:
joecocs
 
Posts: 30
Joined: Wed Jul 04, 2018 11:41 pm
Location: France

Re: manipulation between main form and iframe

Postby kev1n » Thu Feb 13, 2020 1:07 pm

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?
kev1n
 
Posts: 474
Joined: Mon Oct 15, 2018 2:13 am

Re: manipulation between main form and iframe

Postby joecocs » Thu Feb 13, 2020 5:49 pm

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
Console
Capture d’écran 2020-02-13 à 09.14.40.png (139.14 KiB) Viewed 149 times


Is this normal?
joecocs
 
Posts: 30
Joined: Wed Jul 04, 2018 11:41 pm
Location: France

Re: manipulation between main form and iframe

Postby kev1n » Fri Feb 14, 2020 1:14 am

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.
kev1n
 
Posts: 474
Joined: Mon Oct 15, 2018 2:13 am

Re: manipulation between main form and iframe

Postby joecocs » Fri Feb 14, 2020 1:38 am

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 ?
joecocs
 
Posts: 30
Joined: Wed Jul 04, 2018 11:41 pm
Location: France

Re: manipulation between main form and iframe

Postby kev1n » Fri Feb 14, 2020 1:49 am

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 11:34 pm, edited 1 time in total.
kev1n
 
Posts: 474
Joined: Mon Oct 15, 2018 2:13 am

Re: manipulation between main form and iframe

Postby admin » Fri Feb 14, 2020 10:17 am

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
admin
Site Admin
 
Posts: 3217
Joined: Mon Jun 15, 2009 9:53 am

Re: manipulation between main form and iframe

Postby joecocs » Fri Feb 14, 2020 5:22 pm

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
joecocs
 
Posts: 30
Joined: Wed Jul 04, 2018 11:41 pm
Location: France

Next

Return to General