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
renuamirenuami 

help on partial page refresh

Hello

 

Can someone please give me some idea on how to achieve the below?

 

I have a lookUp to user Object. On selecting a value in the user look up i would like the Address information of the selected user  to be populated in the inputfields.

 

 

<apex:Page Controller="test_controller">
<apex:form>
<apex:PageBlock> 
<apex:inputField value="{!aw.User__c}"  />
<apex:inputField value="{!aw.Street__c}"  />
<apex:inputField value="{!aw.City__c}"  />
<apex:inputField value="{!aw.State__c}"  />
<apex:inputField value="{!aw.Country__c}"  />
<apex:inputField value="{!aw.Zip_code__c}"  />

<apex:pageblockButtons location="Bottom">
<apex:commandButton action="{!save}" value="Save"
</apex:pageblockbuttons>
</apex:PageBlock> </apex:form> </apex:page> public class test_controller { public Travel__c aw {get; set;} public test_controller() { aw = new Travel__c(); }
public PageReference save()
    {
        return null;
    }
}

 

 

goabhigogoabhigo

Try <apex:actionSupport> or <apex:actionFunction> 

 


 

renuamirenuami

Hello,

 

I am trying below and it not working . Can any one please advise what is wrong with the below code?

 

Thanks

 

 

 

<apex:page controller="test_controller">
<apex:actionRegion >
<apex:form >
<apex:pageblock >
<apex:outputPanel id="uid_block">
<apex:inputField value="{!tl.User__c}" style="font-size:14px">
<apex:actionSupport event="onchange" action="{!getValues}" rerender="address_block">
<apex:param name="usrId" assignTo="{!UId}" value="{!tl.User__c}" />
</apex:actionSupport>
</apex:inputField>
</apex:outputPanel>

<apex:outputPanel id="address_block">
<apex:inputField value="{!u.Street}" style="font-size:14px"/>
<apex:inputField value="{!u.City}" style="font-size:14px"/>
</apex:outputPanel>

</apex:pageblock>
</apex:form>
</apex:actionRegion>
</apex:page>



--------------------------------

public class test_controller
{
public String UId {get;set;}
    user u;

public User getu()
    {
        return u;
    }

public Travel__c tl {get; set;}

public test_controller()
{
tl = new Travel__c();
}

public PageReference save()
{
return null;
}

public PageReference getValues()
{
if(UId != null && UId != '')
        {
        u = [Select Id,Street, City, State, PostalCode, Country from User where Id=:UId];
        }
return null;
} }