Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

environment/hash variable in an onchange event?

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
homa
Posts: 13
Joined: Fri Sep 19, 2025 11:07 pm
Has thanked: 2 times

environment/hash variable in an onchange event?

Post by homa »

How can I retrieve the available environment/hash variable in an onchange event with a file?
The browser console throws the following error:

Code: Select all

Uncaught ReferenceError: nuHash is not defined
    onchange http://192.168.1.78/index.php:3
2 index.php:3:22

Code: Select all

nuChangeFile(event);alert("Datei onchange"); // Initial report for verification
// nuDebug(nuHash());
console.log("Hash:", nuHash()); // in Browser-Console visible
steven
Posts: 392
Joined: Mon Jun 15, 2009 10:03 am
Has thanked: 58 times
Been thanked: 53 times

Re: environment/hash variable in an onchange event?

Post by steven »

Hi homa,

nuHash() is only a PHP function.

What value are you trying access?


Steven
homa
Posts: 13
Joined: Fri Sep 19, 2025 11:07 pm
Has thanked: 2 times

Re: environment/hash variable in an onchange event?

Post by homa »

Hi Steven,
Thank you for opening my eyes. In the heat of the moment, I forgot to consider the client and server sides — and therefore JavaScript (JS) and PHP.
My first step should be to work with the hash variables.
I plan to load files into the database, retrieve the file name and type, and store these in two additional database fields.
The second step would be to load the PDF files from the database and display them to the user in the browser. But one thing at a time.
As a beginner with nuBuilder, I am currently struggling to handle and edit variables and other database fields. Could you offer any advice?
Matthias
steven
Posts: 392
Joined: Mon Jun 15, 2009 10:03 am
Has thanked: 58 times
Been thanked: 53 times

Re: environment/hash variable in an onchange event?

Post by steven »

Matthias,

We'll need to know more about what you're trying to do.

If you are able to upload a copy of your current database or provide some screenshots, that would be good.


Steven
kev1n
nuBuilder Team
Posts: 4507
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 75 times
Been thanked: 515 times
Contact:

Re: environment/hash variable in an onchange event?

Post by kev1n »

I agree with Steven; we need more details.
Specifically, we need to know how you are loading data into the database. Are you using the nuBuilder File object (Uppy) or another method?
Only then can we provide targeted help, since the answer depends heavily on the method being used.
homa
Posts: 13
Joined: Fri Sep 19, 2025 11:07 pm
Has thanked: 2 times

Re: environment/hash variable in an onchange event?

Post by homa »

I'm happy to explain. Sorry for the late reply, but work got in the way.
I want to use a form to save a file to the database. However, I want to save the file name and type separately in DB fields. I was planning to use the onChange function for this. But would it be better to do it with PHP on the server side?
I'm open to ideas!
If that works, I'd like to be able to display a saved file (preferably a PDF) again, but that's step two!
Here are some screenshots of my progress so far:
2025-09-25 18_48_31-nuBuilder - Dokumente – Mozilla Firefox.png
2025-09-25 18_50_26-nuBuilder - Dokumente (dok) – Mozilla Firefox.png
2025-09-25 18_51_41-nuBuilder - Dokumente (dok) – Mozilla Firefox.png
2025-09-25 19_03_19-192.168.1.78 _ localhost _ nubuilder4 _ dokumente _ phpMyAdmin 5.2.2 – Mozilla F.png
You do not have the required permissions to view the files attached to this post.
Post Reply