Page 1 of 1

Switching between Edit & ReanOnly mode whole form/screen

Posted: 18 Dec 2014, 21:14
by tas95757
I would like to implement a screen w/ TWO modes: Edit and Read-Only. If user chooses to to edit clicking on a button Edit, it will enable editing mode, otherwise the whole screen is Read-Only. User or program can switch back between modes . I am using PF 5.0.
Any help/tips would be highly appreciated.

--- To make it clear:
First, the screen when loaded will be in read-only mode after retrieving from the database, user cannot edit, the whole screen input fields will be set in read-only mode. If user decides the record needs updated. Edit button required to be clicked. All input fields then will be changed to editable. And also, once user complete updating, then saving the record into database, programmatically switch screen back to read-only mode.

Thanks,

Re: Switching between Edit & ReanOnly mode whole form/screen

Posted: 18 Dec 2014, 23:48
by kukeltje
You have to be more specific on what 'read-only' is to you. If it is just input controls in readonly mode, then add the corresponding attribute to the inputs. If otherwise, you might have to duplicate input and output controls. I thought I saw a specific form component once that would make all inputs display as readonly automagically, but alI cannot find it anywhere.

Re: Switching between Edit & ReanOnly mode whole form/screen

Posted: 19 Dec 2014, 00:06
by soekris
Complementing Ronald's answer you can take a look at http://www.primefaces.org/showcase/ui/i ... lace.xhtml, truth be told the example is not very good but inplace allows you to easily separate view mode from edit mode.

Hope it helps

Re: Switching between Edit & ReanOnly mode whole form/screen

Posted: 19 Dec 2014, 21:09
by tas95757
To make it clear:
First, the screen when loaded will be in read-only mode after retrieving from the database, user cannot edit, the whole screen input fields will be set in read-only mode. If user decides the record needs updated. Edit button required to be clicked. All input fields then will be changed to editable. And also, once user complete updating, then saving the record into database, program will switch screen back to read-only mode.

Thanks,

Re: Switching between Edit & ReanOnly mode whole form/screen

Posted: 19 Dec 2014, 21:24
by kukeltje
Then see my original answer