Welcome to the nuBuilder Forums!

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

value set with nuSetIframeValue() is not being saved

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
capstefano
Posts: 21
Joined: Sat Jan 21, 2023 12:17 am
Has thanked: 19 times
Been thanked: 4 times

value set with nuSetIframeValue() is not being saved

Unread post by capstefano »

hello there, I'm having some trouble with the function nuSetIframeValue().

I have an edit form with some objects, among these a text input object which contains the primary key of the record. Another object is an Iframe browse&edit form. I'd like the value of the primary key to be copied in an input field of the Iframe in edit mode.
Before encoding commands in the framework I've tried in the console:

nuSetIframeValue('Iframe_name', 'foreign_field_name', nuGetValue('primary_key_value'))

and got the value correctly copied, but when I save the record the value is not saved and disappears from the object.

What am I doing wrong? Do I need a different approach, using a PHP procedure to save the hash cookie of the primary key and then somehow copy it in the Iframe-edit?
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: value set with nuSetIframeValue() is not being saved

Unread post by kev1n »

Try this modified version:

Code: Select all

function nuSetIframeValue(f, o, v, method) {

	const obj = $('#' + f).contents().find('#' + o)
	return (!method || method == 'val') ? obj.val(v).change() : obj.html(v);

}
Post Reply