Skip to main content The Trailblazer Community will be unavailable from 2/1/2025 to 2/2/2025. Please plan your activities accordingly.
Hi,

I'm trying to pass a value of a field OutputField to a variable of controller, but I can't.

I'm using outputField because I'm using inline editing tag.

What happens is:

When I edit the value, the record is not updated.

So I must get the new value that I'm inserting in this field (OutputField) and send to a variable on Controller,So I can make an update by this way.

Can someone help me?

Best Regards

Rafael

 
2 answers
  1. Apr 12, 2017, 7:35 PM
    Hi Suresh,

    Thanks for your help.

    I will test your code and I let you know if it work.

    Best Regards

    Rafael
  2. Apr 12, 2017, 1:26 PM
    Hi

      You can pass the value by using ActionFunction . Here is some code you can refer ...

       This is a small page which contains one pickList field ie Type... when you will choose "Other" from that Field an section is rendred which contains only hello..

    here is my page..

    <apex:page controller="Mycontrollernew">

    <script type="text/javascript">

    function Callmefunc(id)

    {

    alert(''+id);

    var type = document.getElementById(id).value;

    alert(type);

    check(type);

    //return true;

    }

    </script>

    <apex:form >

    <apex:actionFunction name="check" action="{!makingfield}" reRender="refresh">

    <apex:param name="Mahavir" value="" />

    </apex:actionFunction>

    <apex:pageBlock >

    <apex:pageBlockSection >

    <apex:inputField value="{!account.Type}" id="check" onchange="Callmefunc('{!$Component.check}');">

    </apex:inputField>

    </apex:pageBlockSection>

    <apex:outputPanel id="refresh" >

    <apex:outputPanel rendered="{!readonly=='true'}" >

    helooooo

    </apex:outputPanel>

    </apex:outputPanel>

    </apex:pageBlock>

    </apex:form>

    </apex:page>

    Controller class

    public class Mycontrollernew {

    public Account account{get;set;}

    public String act{get;set;}

    public String readonly {get;set;}

    public Mycontrollernew(){

    }

    public void makingfield() {

    act =System.currentPageReference().getParameters().get('Mahavir');

    System.debug('!!!!!!!!!!!!!!!!!!!asish!!!!!!!!!!!!!LeadType!!!!!!!!!!!!!!!!!'+act);

    if(act=='Other') {

    readonly = 'true';

    }

    }

    }

     
0/9000