2

I have basic user details page, that I display to user when they login. Now once they click on edit they should be able to edit their information on the same page.

I am doing this for the first time I know how to do it in java or php... but apex is very new to me. please provide me with some pointers and examples.

2 Answers 2

1

if you have a custom vf page that you show to users when the login then use apex:outputtext to show read only fields, when a boolean editable is false For example:

<apex:outputText value="{!field}" rendered="{! IF(editable,false,true)}" />

and when they click on click on edit button(which should be custom), just set editable as true and have another display component like:

<apex:inputField value="{!field}" rendered="{!IF(editable,true,false)}" />


Update

As @dphil pointed out you can even use:

<apex:inputfield value="{!field}" rendered="{!editable}" />
3
  • 3
    Not sure if you knew but < apex:inputField value={!field} rendered={!editable}> is the exact same as < apex:inputField value={!field} rendered={!IF(editable,true,false)}>. I tend to code by the simpler the better.
    – dphil
    Commented Sep 15, 2014 at 19:23
  • @dphil that's right and a good point, but since the person has said that he is new to apex and wanted some pointers I thought to carry on with the IF condition to have a consistency in the answer. But again yes, your comment does add simplicity to the example
    – A-d
    Commented Sep 15, 2014 at 19:27
  • beware that if OP is using AJAX rerender="xx" that xx had better be some component on the page that is always present (like the form or some outputPanel) as otherwise the rerender wont rerender something that started off invisible - see the classic Bob Buzzard post : bobbuzzard.blogspot.com/2011/02/…
    – cropredy
    Commented Nov 18, 2014 at 20:01
1

You may be looking for the inlineEditSupport tag. Here is the documentation.

Example

<apex:outputField value="{!field}">
    <apex:inlineEditSupport event="ondblclick" />
</apex:outputField>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .