Page 1 of 1

Subform row id - hash cookie

Posted: Sat Jan 06, 2018 6:17 pm
by tovidiu
I'm trying to create a button that opens the record from another table to be edited but I can not do it because I do not know the record_id of the row from the subform to insert it into the filter field.
The field "Nr Top" holds the id field of "Parcele extravilan" form, i put the id field in the browse of "Parcele extravilan"

What am I doing wrong?
THX

Re: Subform row id - hash cookie

Posted: Sat Jan 06, 2018 6:48 pm
by admin
tovidiu,

Great question.

Instead of using a Run Object, use an Input Object and set its Type to Button (they should still look the same).

Add an onclick Event via its Custom Code Tab with the following Javascript.

Code: Select all

nuPopup('aaaa', nuSubformRowId(this));           //-- make aaaa the id of the Form you would like to open
Here is some help in the wiki ...

http://wiki.nubuilder.net/nubuilderfort ... ab_-_Input

http://wiki.nubuilder.net/nubuilderfort ... pt#nuPopup

http://wiki.nubuilder.net/nubuilderfort ... bformRowId


Steven

Re: Subform row id - hash cookie

Posted: Sat Jan 06, 2018 9:10 pm
by tovidiu
Thanks for the reply,
I did as you said but it does not work, nothing happens when I click on the button.
this is the code

Code: Select all

nuPopup('5a29ddbd60e1aa9', nuSubformRowId(this));
I modified the code according to the parameters "noPopup (string1, string2, string3)" as follows

Code: Select all

nuPopup('5a29ddbd60e1aa9', '', nuSubformRowId(this));
but it still does not work.

in this version should open the form '5a29ddbd60e1aa9' as browse with filter nuSubformRowId(this), but stil nothing happens. As if it did not read the row id of the subform.


it is possible to use the following code? I want to use the lookup field not the subform row id, because like this it will open up directly in Edit form

Code: Select all

nuPopup('5a29ddbd60e1aa9','lookup_field');
Ovidiu

Re: Subform row id - hash cookie

Posted: Sat Jan 06, 2018 9:44 pm
by admin
Ovidiu,

You will need the lastest from github because I just added nuSubformRowId().

If you want the value from a Lookup or other Object try...

Code: Select all

nuSubformValue(this, 'ite_product_id');

Steven

Re: Subform row id - hash cookie

Posted: Sat Jan 06, 2018 10:07 pm
by tovidiu
It works perfectly!

Thank you very much Steven!

Ovidiu

Re: Subform row id - hash cookie

Posted: Sat Jan 06, 2018 10:50 pm
by tovidiu
And if I have the same case but the lookup object and the button are in form not subform, how can i read the lookup value to use it in Javascript?

for example:

Code: Select all

nuPopup('5a29ddbd60e1aa9', nuFormValue(this, 'lookup_field'));
Ovidiu

Re: Subform row id - hash cookie

Posted: Sat Jan 06, 2018 10:57 pm
by admin
Ovidiu,

If your Object is on an Edit Form, you can get the value this way...

Code: Select all

var v = $('#lookup_field_id').val();               //-- the Object's ID prefixed by a #
Here are other ways you can use this $() jQuery function... https://www.w3schools.com/jquery/jquery ... ectors.asp

Steven

Re: Subform row id - hash cookie

Posted: Sat Jan 06, 2018 11:13 pm
by tovidiu
Thank you, it works!!

Ovidiu

Re: Subform row id - hash cookie

Posted: Sun Jan 07, 2018 12:00 am
by admin
.