Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Reload main form on subform change?

Post Reply
Tinka
Posts: 73
Joined: Mon Feb 24, 2014 2:58 pm

Reload main form on subform change?

Unread post by Tinka »

I have made an edit button for each subform row, that will open an edit form for this record in an iFrame popup, changing the code slightly from this post:
http://forums.nubuilder.cloud/viewtopic.p ... 0d5#p12970
The reason for this is some validation in the JS section with nuBeforeSave and that the subform rows are read-only as default.

On the JS main form:

Code: Select all

//edit button on subform
function openChild(t){

   var rw  = $('#' + t.id).attr('data-prefix')   //-- current row in subform
   var id  = rw + '_nuPrimaryKey';               //-- Primary Key for record in subform
   var fpk = '5361ec013b6ca4f';                  //-- Form Primary Key
   var rpk = $('#' + id).val();                  //-- Record Primary Key

   
 nuOpenFormInFrame(fpk,rpk); //--open form in floating window


}
OnClick event of Edit button

Code: Select all

openChild;
On AfterSave of subform record Edit form:

Code: Select all

$js = " 
function detect(){
if (nuFORM.edited){
    nuSetHash('chg','1');
var det = 1  
return det;
}
}
nuRemoveModal(); //--close frame


       ";

nuAddJavascript($js);

This part works.

Now I want to reload the main form, when the subform record was changed to show the changes in the subform.
Essentially what the reload button in the lower right corner does, but without omitting any other changes by the user on the main form!
I played around with functions and nuSetHash in AfterSave of the subform, and in the Javascript of the main form, but it doesn't work.
How can I achieve this? Essentially the same functionality like if the "Add record" button was clicked on a lookup and the values are sent back to the lookup and then to the main form.

Tinka
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Reload main form on subform change?

Unread post by admin »

Tinka,

I understand your question but at the moment I don't have an answer.

Steven
TirasX
Posts: 8
Joined: Tue Jun 14, 2016 10:29 am

Re: Reload main form on subform change?

Unread post by TirasX »

Hello,

is there any update on that request?

Thanks.
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Reload main form on subform change?

Unread post by admin »

No
Post Reply