Page 1 of 2
Variables on Subform->Button->RecordID (bug?)
Posted: Wed Jul 18, 2012 1:55 am
by esstein
I can't use a variable of query result on subform button object.
And the field is correctly added on SQL of subform:
I'm asking because it is working on another older version of nuBuilder.
To it works I made one workaround:
1) setting a blank form on "Form To Launch via Browse";
2) setting the "venda_id2" (primary key
venda_id + number 2) on "Field Name";
3) adding a JavaScript on "On Double Click":
Code: Select all
openForm('14fcd2c1fbdd61',document.getElementById(this.name.substring(0,this.name.length-1)).value);
It will back to work on future version?
Thanks in advanced!
Evandro
Re: Variables on Subform->Button->RecordID (bug?)
Posted: Thu Jul 19, 2012 1:31 am
by admin
Evandro,
Is this button on a subform?
Steven
Re: Variables on Subform->Button->RecordID (bug?)
Posted: Fri Jul 20, 2012 12:30 am
by esstein
Yes! Excuse my bad English. Thanks
Re: Variables on Subform->Button->RecordID (bug?)
Posted: Fri Jul 20, 2012 6:02 am
by admin
Evandro,
Although this works on the main Edit Form, on a subform, each Object has a prefix to its name..
Untitled.png
making it impossible to refer to it as you have tried.
You will need to find another way.
Maybe by updating an Object on the main Edit Form from the row you are currently on, with javascript. (maybe in the onclick of the button)
You could probably even call that field
venda_id, as is it would clash with any other fields on the Edit Form and you wouldn't have to make any changes to your button.
Steven
Re: Variables on Subform->Button->RecordID (bug?)
Posted: Fri Jul 20, 2012 8:16 am
by esstein
Hi Steven,
I want to use the "Form To Launch via Browse" to open form. It stops to work on new versions of nuBuilder.
This is a picture of another system that I am using an old version of nuBuilder and the
"detalhes" button opens the
"Cooperados" form correctly with variable "#medico#" on RecordID:
old-version-the-button-is-working.png
I'm using JavaScript to the button works on new version, but it is a workaround.
---
On the actual version of nubuilder, I tried to use "#venda_id#" to open "frmVenda" form, but the variable "#venda_id#" is not replaced with query result value (number 7). This is the subform:
new-version-is-not-working.png
---
To work on new version I must to disable the "Form To Launch via Browse" and find the Record Id (r=7) using getElementById on the "ver" button:
recnum-7.gif
getElementById-name+1.png
The "
openForm('14fcd2c1fbdd61',document.getElementById(this.name.substring(0,this.name.length-1)).value)" will find the correct record id.
If I use the same name on button object, the subform not show correctly. So, I used
subform_NVenda0000venda_id2 (name.length+1) to find the value of
subform_NVenda0000venda_id (name.length-1).
The best and simple way to open a form is use the "Form To Launch via Browse" button attribute. Have it some chance to #variable# back to be replaced with sql result on subform?
Thanks,
Evandro
Re: Variables on Subform->Button->RecordID (bug?)
Posted: Mon Jul 23, 2012 6:13 am
by admin
Evandro,
The function
nuGetRowId() might make your JavaScript a bit easier.
http://wiki.nubuilder.com/tiki-index.ph ... uGetRowId_
Steven
Re: Variables on Subform->Button->RecordID (bug?)
Posted: Mon Jul 23, 2012 6:30 am
by esstein
It helps. Thanks.
By the way, why Record ID of Button object stops to replace db_fetch values?
Regards,
Evandro.
Re: Variables on Subform->Button->RecordID (bug?)
Posted: Mon Jul 23, 2012 7:12 am
by admin
Evandro,
Sorry, I don't understand the question.
Steven
Re: Variables on Subform->Button->RecordID (bug?)
Posted: Tue Jul 24, 2012 1:58 am
by esstein
Hi Steve,
The configuration below stopped to work on new version of nuBuilder:
Thanks,
Evandro
Re: Variables on Subform->Button->RecordID (bug?)
Posted: Tue Jul 24, 2012 10:10 am
by admin
Evandro,
You can put the hash variable in Default Filter for Browse Screen.
But there is a bug.
Steven