Welcome to the nuBuilder forums!
Please register and login to view forums and other content only available to registered users.
Please register and login to view forums and other content only available to registered users.
Button Object in subform
-
- Posts: 177
- Joined: Tue Nov 15, 2011 2:24 pm
Button Object in subform
Hi,
I have a button in a subform that would open that record in an edit screen. I'm using the hash variable #SUBFORM_RECORD_ID# .
But when I click in the button it opens the form but with empty fields.
Could you please advise?
Thank you.
I have a button in a subform that would open that record in an edit screen. I'm using the hash variable #SUBFORM_RECORD_ID# .
But when I click in the button it opens the form but with empty fields.
Could you please advise?
Thank you.
BR
Rui
Rui
-
- Site Admin
- Posts: 2778
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
Re: Button Object in subform
Rui,
Has that subform record previously been saved? Because it won't have an Primary Key until it does.
Steven
Has that subform record previously been saved? Because it won't have an Primary Key until it does.
Steven
-
- Posts: 177
- Joined: Tue Nov 15, 2011 2:24 pm
Re: Button Object in subform
Hi Steven,
Yes, I have a record saved in the subform (goodin_subform).
Thank you.
Yes, I have a record saved in the subform (goodin_subform).
Thank you.
BR
Rui
Rui
-
- Site Admin
- Posts: 2778
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
-
- Posts: 177
- Joined: Tue Nov 15, 2011 2:24 pm
Re: Button Object in subform
Hi Steven,
Yes, it does work with the id hardcoded but does not with the hash variable #SUBFORM_RECORD_ID#.
Yes, it does work with the id hardcoded but does not with the hash variable #SUBFORM_RECORD_ID#.
BR
Rui
Rui
-
- Site Admin
- Posts: 2778
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
Re: Button Object in subform
rui,
Come to think of it #SUBFORM_RECORD_ID# is used by Display Objects or Lookup Objects not Javascript.
To get the ID you can use this JavaScript function http://wiki.nubuilder.net/index.php/Jav ... 28pThis.29
You can use nuRowPrefix(this) or nuRowNumber(this) to find the row number.
eg.
Steven
Come to think of it #SUBFORM_RECORD_ID# is used by Display Objects or Lookup Objects not Javascript.
To get the ID you can use this JavaScript function http://wiki.nubuilder.net/index.php/Jav ... 28pThis.29
You can use nuRowPrefix(this) or nuRowNumber(this) to find the row number.
eg.
Code: Select all
$('#' + nuRowPrefix(this) + '_nuPrimaryKey').val()
-
- Posts: 8
- Joined: Mon Aug 03, 2015 8:36 pm
Re: Button Object in subform
This looks like it may solve the problem i posted, but I have no idea where to put this code or what to put into the 'Record ID" field on the button.
Can someone point me in the right direction?
Can someone point me in the right direction?
-
- Site Admin
- Posts: 2778
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
-
- Posts: 8
- Joined: Mon Aug 03, 2015 8:36 pm
Re: Button Object in subform
Unfortunately, I still have no idea what to do with this code, or where to put it.
-
- Site Admin
- Posts: 2778
- Joined: Mon Jun 15, 2009 2:23 am
- nuBuilder Version: 4.5
Re: Button Object in subform
steve,
You put can call a JavaScript function on a button here..
And create the function here..
Steven
You put can call a JavaScript function on a button here..
And create the function here..
Code: Select all
function myFunction(){
var id = $('#' + nuRowPrefix(this) + '_nuPrimaryKey').val();
nuOpenFormInFrame('55494eebbb1c5d0', id); //**** you need to find out the Form's ID in the database
}
Steven