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
dai tran 6dai tran 6 

Why actionSupport can't send parameter?

Home page:
<apex:image styleClass="img"   value="{!URLFOR($Resource.MainImage, 'MainImage/womansun.jpg' )}"> 
        <apex:actionSupport event="onclick" action="{!goShopping}" >
            <apex:param assignTo="{!glasstype}" value="SUN" name="gtype" />
            <apex:param assignTo="{!sex}" value="Woman" name="gsex" />
        </apex:actionSupport>
    </apex:image>

Controller:
public PageReference goShopping()
    {
        System.debug(glasstype + sex);
        PageReference p=new PageReference('/apex/shopping');
        return p;   
    }

Log:
03:59:29.0 (12865001)|USER_DEBUG|[18]|DEBUG|nullnull

Why actionSupport can't send parameter?
dai tran 6dai tran 6
controller:
public string glasstype {get;set;}
public string sex {get;set;}

 
Akshay_DhimanAkshay_Dhiman
Hi dai tran 6

Try for this code. 
 
<apex:image styleClass="img"   value="{!URLFOR($Resource.MainImage, 'MainImage/womansun.jpg' )}"> 
        <apex:actionSupport event="onclick" action="{!goShopping}" >
            <apex:param assignTo="{!glasstype}" value="SUN" name="gtype" />
            <apex:param assignTo="{!sex}" value="Woman" name="gsex" />
        </apex:actionSupport>
    </apex:image>
 
 public PageReference goShopping()
    {
     String gender=ApexPages.currentPage().getParameters().get('gsex');
  String gtype=ApexPages.currentPage().getParameters().get('gtype');
        System.debug('gender'+ gender);
  System.debug('gtype'+ gtype);
        
        return new PageReference('/apex/shopping');
    }


If you found this answer helpful then please mark it as best answer so it can help others.   
  
  Thanks 
  Akshay
dai tran 6dai tran 6
It had set parameter by assignTo:
assignTo="{!glasstype}"
apex:actionSupport  not support apex:image?
https://developer.salesforce.com/forums/?id=906F000000094uSIAQ
 
Ajay K DubediAjay K Dubedi
Hi Dai,

Please try the below code. Hope this helps you.

<apex:commandLink action="{!goShopping}">
    <apex:image styleClass="img"   value="{!URLFOR($Resource.MainImage, 'MainImage/womansun.jpg' )}"> 
            <apex:param assignTo="{!glasstype}" value="SUN" name="gtype" />
            <apex:param assignTo="{!sex}" value="Woman" name="gsex" />
    </apex:image>
</apex:commandLink>

public PageReference goShopping()
    {
        System.debug(glasstype + sex);
        PageReference p=new PageReference('/apex/shopping');
        return p;   
    }

Please select as best answer if it helps you.

Thank You,
Ajay Dubedi