function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Peter2mPeter2m 

<apex:inputText > as parameter to save action

<apex:pagestandardController="Opportunity"extensions="customer_operations"

.

.

.

<apex:outputPanel id="TelephoneNumber" rendered="{!ShowTelephoneNumber}" layout="block" >     
       <apex:pageBlock title="Edit TelephoneNumbers">
                 <apex:pageBlockTable value="{!EditTelephoneNumbers}" var="e">
                  <apex:column >
            <apex:facet name="header">Mobile Number</apex:facet>
            <apex:inputText id="eTelephoneNumber" value="{!e.TelephoneNumber}"/>
         </apex:column> 
         <apex:column >
            <apex:facet name="header">Length</apex:facet>
            <apex:inputText id="eLength" value="{!e.Length}"/>
         </apex:column> 
         <apex:column >
            <apex:facet name="header">Companyname</apex:facet>
            <apex:inputText id="eCompanyname" value="{!e.Companyname}"/>
         </apex:column>           
        </apex:pageBlockTable>
        
        <apex:pageBlock id="block">
                <apex:pageBlockSection >
                   <apex:pageBlockSectionItem >
                       <apex:commandButton value="Save" action="{!save}"  rerender="block">
            <apex:param name="myParam1" value="{!$Component.frm.eCompanyname}"/>
                       </apex:commandButton>            
                   </apex:pageBlockSectionItem>
                </apex:pageBlockSection>
        </apex:pageBlock>   
       </apex:pageBlock>
      </apex:OutputPanel>

 

public void save() {
     string myParam = apexpages.currentpage().getparameters().get('myParam1');
     system.debug('************************************************');
     system.debug( myParam);
     system.debug('************************************************');
     //Here a want to create a new instance of my custom object <Phone_Numbers__c>
     // with information from params.
     }

 

How can a get the value of myParam to be the value of <apex:inputText id="eCompanyname" value="{!e.Companyname}"/> ?

kiranmutturukiranmutturu

as u already have that inputtext value in the class y u need to assign it param once again..as inputtext is accepting a value it will come to back end w.r.t value attribute binded to that...u can make use of that na?...

bob_buzzardbob_buzzard

The $Component reference you are using refers to part of the pageblocktable iteration, so it won't equate to a single component.  There's effectively one component per row of the table and you can't reliably access them through that mechanism.

 

I wrote a blog post explaining how list (collection) values are sent back to the controller at:

 

http://bobbuzzard.blogspot.com/2011/03/persisting-list-edits-in-visualforce.html

 

does that help?

ColinKenworthy2ColinKenworthy2

You don't show if you have any Form or ActionRegion tags in your page, also the Save button just rerenders the area containing thte save button.