Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Need example of NuSetHash

Post Reply
jegalink
Posts: 16
Joined: Mon Feb 09, 2015 6:17 pm

Need example of NuSetHash

Unread post by jegalink »

I'm not very familiar with JavaScript - so I wonder if someone could give me a very basic example of how to use NuSetHash to pass a variable (in this case, an ID from a related table) from one edit form that submits data (using a button object with recordID set to -1) to another edit form in series (both forms are not open at once). The second edit form will need to submit the variable value to a third form, like an html hidden form field would do. Any form field name or value will be fine on the example. I just need to see an example of basic syntax for this that works - and where that code would be inputed in the nuBuilder globeadmin interfaces. Thanks for any help!
admin
Site Admin
Posts: 2778
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5

Re: Need example of NuSetHash

Unread post by admin »

jegalink,

Have you seen the wiki? http://wiki.nubuilder.net/nubuilderv3/i ... _Variables

Steven
jegalink
Posts: 16
Joined: Mon Feb 09, 2015 6:17 pm

Re: Need example of NuSetHash

Unread post by jegalink »

Yes, I sure have. But I think the documentation on this presupposes a good working knowledge of Javascript, which I don't have. I don't know where/how to use the nuSetHash() or nuGetHash() JavaScript functions to pass a variable value from one edit form to another edit form. I'm trying to read up a bit on Javascript, but it's slow going. Perhaps I'll get there on my own - I just thought if there is a simple example I could follow, that would speed things up.

Thanks though.
admin wrote:jegalink,

Have you seen the wiki? http://wiki.nubuilder.net/nubuilderv3/i ... _Variables

Steven
hanstel
Posts: 28
Joined: Sat Apr 30, 2016 2:51 am

Re: Need example of NuSetHash

Unread post by hanstel »

jegalink
Posts: 16
Joined: Mon Feb 09, 2015 6:17 pm

Re: Need example of NuSetHash

Unread post by jegalink »

Yes, I saw that one. I searched quite a lot before posting my questions. The interplay between the JavaScript object and the hash variables server side (that can be used in the subsequent form), if there is any, is what I'm not understanding. I also was just asking for a simple syntax example of where/how nuSetHash could be used to accomplish this interplay, if indeed it could.

Thanks for the responses - I realize I may be asking too much. I'll keep poking around with some trial and error on my own.
jegalink
Posts: 16
Joined: Mon Feb 09, 2015 6:17 pm

Re: Need example of NuSetHash

Unread post by jegalink »

OK, I put the following line (all by itself) into Custom Code > Javascript for FORM A (which I then access as an edit form):

Code: Select all

nuSetHash('tester', 'blabla');
FORM A (as an edit form) has a button object which, when clicked, directs to FORM B with the record ID set to -1 (to pull up a new blank edit form).
I put the following line of code into Custom Code > Before Open for FORM B:

Code: Select all

nuDisplayError('#tester#');
The error message that pops up when I click the button on FORM A shows this:
#tester#
Obviously I'm missing something elementary here, and probably showing my ignorance (already admitted) of Javascript, but am I anywhere near being on the right track?
admin
Site Admin
Posts: 2778
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5

Re: Need example of NuSetHash

Unread post by admin »

jegalink,

I tried to do the same and it worked..

(if you hit F12 you will get developer tools)
Capture7.PNG
Capture7.PNG (62.87 KiB) Viewed 12217 times
nuSetHash() adds a variable to nuFORM.

Is your system doing that?

Steven
Post Reply