Switching between Edit & ReanOnly mode whole form/screen

UI Components for JSF
Post Reply
tas95757
Posts: 2
Joined: 19 Mar 2013, 01:55

18 Dec 2014, 21:14

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,
Last edited by tas95757 on 19 Dec 2014, 20:14, edited 1 time in total.

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

18 Dec 2014, 23:48

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.

soekris
Posts: 76
Joined: 29 Apr 2013, 16:54
Location: Barcelona

19 Dec 2014, 00:06

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
Primefaces 5.3.X / 6.X
NetBeans 8.1
WildFly 10
Linux Mint & freeBSD

tas95757
Posts: 2
Joined: 19 Mar 2013, 01:55

19 Dec 2014, 21:09

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,

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

19 Dec 2014, 21:24

Then see my original answer

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests