Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Transfer a Value into a new Form

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
getNo
Posts: 21
Joined: Thu Feb 18, 2021 5:56 pm

Transfer a Value into a new Form

Unread post by getNo »

hey there,

first of all i am a German native , you will see on the screenshots, so my English is not the prettiest. as you will notice in the screenshots, i turned the color theme to red for buttons etc.

I have this edit form with a jstree via html-object
2021-03-05 14_04_17-nuBuilder - Anfragebaum_IB.png

to use the buttons below, the user has to select an active node of the tree. so the node-id is set as an value.
2021-03-05 14_02_21-nuBuilder - Anfragebaum_IB.png
With the Button "Annehmen", i go into a new form. How can i get the value of the field or the node into the new form? the new form must be a edit form with a new record set and the field is not the primary key.
2021-03-05 14_11_26-nuBuilder - Anfrage_Annehmen.png

the code for the activated node:
2021-03-05 14_09_51-nuBuilder - Anfrage_Data.png



i hope my question is clear. Surely it is a easy proplem for you, but i am a bit noobish on web-development.
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4299
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Transfer a Value into a new Form

Unread post by kev1n »

When the button "Annehmen" is clicked assign the value of Anfrage_His_ID to a variable AnfHisID. Use the button's onclick event in the Custom Code tab:

Code: Select all

window.AnfHisID = $('#Anfrage_His_ID').val();
custom_code.png
Then, in the new form, retrieve the value and assign it to AnfHisID.

Code: Select all

if (nuFormType() == 'edit') {
   $('#AnfHisID').val(window.AnfHisID);
}
I hope that helps.
You do not have the required permissions to view the files attached to this post.
getNo
Posts: 21
Joined: Thu Feb 18, 2021 5:56 pm

Re: Transfer a Value into a new Form

Unread post by getNo »

worked as expected. thank you.

Update: well not completely.
The field is filled corectly, but when i save the form, without editing the Anfrage_His_ID, it becomes Zero in the Database.
kev1n
nuBuilder Team
Posts: 4299
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Transfer a Value into a new Form

Unread post by kev1n »

Code: Select all

$('#AnfHisID').val(window.AnfHisID).change()
getNo
Posts: 21
Joined: Thu Feb 18, 2021 5:56 pm

Re: Transfer a Value into a new Form

Unread post by getNo »

thanks
Post Reply