Welcome to the nuBuilder Forums!

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

Subform readonly

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
vanman
Posts: 54
Joined: Thu Mar 01, 2018 11:09 pm
Has thanked: 1 time

Subform readonly

Unread post by vanman »

Hi

I have a product subform on a quote that when the quote is accepted by the customer I want all objects except a few to be disabled so they can not be changed.

I have tried to disable the subform but the fields can still be changed. Have tried to make a copy of the form that is read only but it can still be changed.

Is there another way to disable the subform and it's contents?

Thanks

Paul
kev1n
nuBuilder Team
Posts: 4299
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Subform readonly

Unread post by kev1n »

Hi Paul

Based on this post:

Code: Select all

function disableSubform(f, allowInsertions) {

	$('[id ^=' + f + ']').prop("disabled", true);

	if (allowInsertions) {
		const r = nuPad3(nuSubformObject(f).rows.length - 1);
		$('[id ^=' + f + r + ']').prop("disabled", false);
	}

}


if (!nuIsNewRecord()) { // Disable if it's not a new record
	disableSubform("YOUR_SUB_FORM_ID", false); // <------------- replace with your subform id
}

vanman
Posts: 54
Joined: Thu Mar 01, 2018 11:09 pm
Has thanked: 1 time

Re: Subform readonly

Unread post by vanman »

Thank You
Post Reply