+ Start a Discussion

<apex:inputText > as parameter to save action





<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:facet name="header">Length</apex:facet>
            <apex:inputText id="eLength" value="{!e.Length}"/>
         <apex:column >
            <apex:facet name="header">Companyname</apex:facet>
            <apex:inputText id="eCompanyname" value="{!e.Companyname}"/>
        <apex:pageBlock id="block">
                <apex:pageBlockSection >
                   <apex:pageBlockSectionItem >
                       <apex:commandButton value="Save" action="{!save}"  rerender="block">
            <apex:param name="myParam1" value="{!$Component.frm.eCompanyname}"/>


public void save() {
     string myParam = apexpages.currentpage().getparameters().get('myParam1');
     system.debug( myParam);
     //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}"/> ?


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?...


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:




does that help?


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.