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
Deepak ChouhanDeepak Chouhan 

assing apex variable by visualforce tag

hi,
i am using
                <apex:repeat value="{!item_Details}" var="item">
                    <apex:outputPanel styleClass="op_Item_Details" >                   
                        <apex:outputField value="{!item.Image__c}"/>                   
                        <apex:outputLabel value="{!item.Product_Name__c}"/>                      
                        <apex:outputLabel value="{!item.Price__c}" id="me"/> /-                       
                     <apex:commandButton value="Item Details" action="{!show_Item_Description}" rerender="item_Popup" style="width:100px;"/>
                    </apex:outputPanel>
                </apex:repeat>

and i want to assing apex variable to above current product item.
i have used actionfunction for onclick event on commandbutton but it's not working.
ShashForceShashForce
Hi Deepak,

Can you provide the actionfunction code that you tried, so that I can understand better what you are trying to achieve exactly? Also, please help me understand your requirement better by providing more details.

Thanks,
Shashank
Deepak ChouhanDeepak Chouhan
Hi Shashank,

<apex:outputPanel styleClass="op_Item_ContainerInner">
                <apex:repeat value="{!item_Details}" var="item">
                    <apex:outputPanel styleClass="op_Item_Details" >
                  
                        <apex:outputField value="{!item.Image__c}" id="iImage"/>
                        <apex:outputLabel value="{!item.Product_Name__c}" id="iName"/>
                        <apex:outputLabel value="{!item.Price__c}" id="iPrice"/> /-
                        <apex:commandButton value="Item Details" action="{!show_Item_Description}" rerender="item_Popup" style="width:100px;"  onclick="callActionMethod()" />

                    </apex:outputPanel>
                </apex:repeat>

                <apex:actionFunction name="popupSetValue" action="{!popup_Details}" reRender="popup_Result">
                        <apex:param name="image_Param" assignTo="{!product_iImage}" value="" />
                        <apex:param name="name_Param" assignTo="{!product_iName}" value="" />
                        <apex:param name="price_Param" assignTo="{!product_iPrice}" value="" />
                 </apex:actionFunction>
       
            </apex:outputPanel>

--------------------------------------
<script type="text/javascript">
function callActionMethod()
{
var txtImage= document.getElementById("{!$Component.frm.iImage}").value;
var txtName= document.getElementById("{!$Component.frm.iName}").value;
var txtPrice= document.getElementById("{!$Component.frm.iPrice}").value;

popupSetValue(txtImage,txtName,txtPrice);
}
</script>
-------------------------------