Page 1 of 1

launch an edit form from a subform

Posted: Sat Aug 02, 2014 11:08 am
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

Re: launch an edit form from a subform

Posted: Tue Aug 05, 2014 2:17 am
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

Re: launch an edit form from a subform

Posted: Tue Aug 05, 2014 8:41 am
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

Re: launch an edit form from a subform

Posted: Wed Aug 06, 2014 1:08 am
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