Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

read only form with edit button

Locked
barrydocks
Posts: 18
Joined: Wed Dec 18, 2013 4:44 pm

read only form with edit button

Unread post by barrydocks »

I would like to create a read only form with an edit button to allow data changes. My first thought was to create an action button that would load a read/write clone of the original form. Alternatively, I could add an action button that allows a read only form to become a read write form.

Any suggestions on how to accomplish this?

Thanks
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: read only form with edit button

Unread post by massiws »

barrydocs,
there are different ways: it depends on what you need.
barrydocks wrote:My first thought was to create an action button that would load a read/write clone of the original form.
that's what Clone button does (you can also add Display conditions to make it appear only in some cases): the cloned record isn't saved until Save button is pressed. You may want to check your login with Javascript/jQuery in nuBeforeSave() or nuBeforeClone() functions and/or PHP in Custom Code > Before Save.
barrydocks wrote:I could add an action button that allows a read only form to become a read write form.
This could be done in Custom Code > Javascript, for example, add this code in your form to hide Save button:

Code: Select all

function nuLoadThis() {

    //Disable Save button
    $("#nuActionSave").toggle();
    
    // Set all INPUT elements to readonly
    $(":input").attr("readonly","readonly");
    
}
To restore Save button or readonly values you could add a Extra Action button like this:
ExtraActionButton.png
ExtraActionButton.png (12.38 KiB) Viewed 12629 times
Hope this helps,
Max
Tinka
Posts: 73
Joined: Mon Feb 24, 2014 2:58 pm

Re: read only form with edit button

Unread post by Tinka »

Hi

This only makes input fields read-only, but not lookups. Is there an easy way to include these?

BR, Tinka
admin
Site Admin
Posts: 2778
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5

Re: read only form with edit button

Unread post by admin »

.
Locked