Need example of NuSetHash

Need example of NuSetHash

Postby jegalink » Mon May 30, 2016 11:22 pm

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!
jegalink
 
Posts: 16
Joined: Tue Feb 10, 2015 2:47 am

Re: Need example of NuSetHash

Postby admin » Tue May 31, 2016 9:16 am

admin
Site Admin
 
Posts: 3077
Joined: Mon Jun 15, 2009 9:53 am

Re: Need example of NuSetHash

Postby jegalink » Thu Jun 02, 2016 12:28 am

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/index.php/Hash_Variables

Steven
jegalink
 
Posts: 16
Joined: Tue Feb 10, 2015 2:47 am

Re: Need example of NuSetHash

Postby hanstel » Thu Jun 02, 2016 10:25 pm

hanstel
 
Posts: 28
Joined: Sat Apr 30, 2016 10:21 am

Re: Need example of NuSetHash

Postby jegalink » Fri Jun 03, 2016 7:34 am

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: Tue Feb 10, 2015 2:47 am

Re: Need example of NuSetHash

Postby jegalink » Fri Jun 03, 2016 9:13 am

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?
jegalink
 
Posts: 16
Joined: Tue Feb 10, 2015 2:47 am

Re: Need example of NuSetHash

Postby admin » Thu Aug 11, 2016 9:13 am

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 6029 times


nuSetHash() adds a variable to nuFORM.

Is your system doing that?

Steven
admin
Site Admin
 
Posts: 3077
Joined: Mon Jun 15, 2009 9:53 am


Return to Custom Code