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

Passing parameter from input text inside a pageblock table to a controller method

I have a page block table with a number of columns, The first is an input text where the user would enter id of a record, in the next two columns i want to fetch record information of the id entered by the user. I am trying to do this on blur using action support. below is the code


<apex:pageBlockTable id="bodyTable" value="{!Records}" var="acc" rowClasses="odd,even" styleClass="tableClass" cellpadding="" cellspacing="" align="center">
                <apex:column style="text-align:center;">
                    <apex:facet name="header">Number</apex:facet>
                    <apex:outputPanel >
                        <apex:inputText value="{!}">
                        <apex:actionSupport event="onblur" action="{!getInfo}" reRender="bodyTable" status="counterStatus">
                        <apex:param name="seno" value="{!}"/>
                    <apex:actionStatus id="counterStatus" startText="Fetching.." stopText=""/>

then there are rest of the colums

 In the Class if I am trying to acces what the user entered in the text box, it gives me null

    public PageReference getInfo(){
        String sNumber = ApexPages.currentPage().getParameters().get('no');
        system.debug('GET INFO CALLED'+sNumber);
        return null;

 Any clues where i might be wrong

Best Answer chosen by Admin (Salesforce Developers) 

As the onblur method is nested in the input field, can you not use the 'this' syntax?

All Answers


The problem here is that the apex parameter value is determined at render time as you have used a merge field.  Thus if this values starts out empty, that is what will be sent through to the controller.


The way I'd approach this is to create an actionfunction that takes a parameter, then invoke that from the onblur javascript with the value from the HTML element.


Thanks for your quick reply. I am not sure if would be able to use the HMTL id to get the parameter value, as the table is a dynamic one with the user having an option to go on adding rows as he wants, I checked the ids generated for the input text, they are as follows




So my problem is how would my code understand from which id to pick after the on blur method


As the onblur method is nested in the input field, can you not use the 'this' syntax?

This was selected as the best answer

Worked well... Thanks