Welcome to the nuBuilder Forums!

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

launch an edit form from a subform

Post Reply
WRBailey
Posts: 13
Joined: Fri Jun 06, 2014 9:44 am

launch an edit form from a subform

Unread post by WRBailey »

I have an hierarchical app. I have created a table of main entries. I then created child entries. I have used NuBuilderPro to build a browse form and an edit form for the main entries. On the edit form I have a subform with a grid for the child entries. I would like to allow a user to click on one of the subform rows (almost any way that works would be okay) to launch an edit form for the child that will have on it a subform of grandchildren. Once I can do one level then I should be able to keep going.

Thank you.

Bill Bailey
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: launch an edit form from a subform

Unread post by admin »

WRBailey,

On your subform, create a button with an event like this.
Capture.PNG
and create a function like this (in the Custom Code > Javascript Tab of the Form)..

Code: Select all


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 = '53e0208f324b6b8';                  //-- Form Primary Key
   var rpk = $('#' + id).val();                  //-- Record Primary Key

   window.nuControlKey = true;                   //-- simulate holding down CRTL (open in new Tab)

   nuOpenForm('', '', fpk, rpk);

   window.nuControlKey = false;
}

Hope this helps

Steven
You do not have the required permissions to view the files attached to this post.
WRBailey
Posts: 13
Joined: Fri Jun 06, 2014 9:44 am

Re: launch an edit form from a subform

Unread post by WRBailey »

Thank you, Steve. I guess I'm not as far along as I thought.

I have another question.

I only know how to use the subform wizard to create a subform and the subform I created is a grid. Therefore I don't know how to create a button within a row of my subform. I tried adding an object but it tells me the column doesn't exist. So I tried it without a name and the subform works but it has nothing about the column with no name.

How do I add a button to my subform?

Thanks again.

Bill
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: launch an edit form from a subform

Unread post by admin »

Bill,

The easiest way to create a button on a subform that already has an Object on it is to clone the one there and change its properties (eg. Type to Button).

To bring up a Subform Object's properties, double click its title as the black circles suggest here.. http://wiki.nubuilder.net/index.php/Developer_Tools

Steven
Post Reply