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
debprakash shawdebprakash shaw 

How to pass the value of input from vf page to apex controllers

Hi, every, I'm stuck on my VF page, unable to pass the input value from the VF page to the apex controller.
My Apex controller:==
```
public with sharing class RefundPaymentController {
    public static Id paymentId{get;set;}
    public static Payment__c paymnt {get;set;}
  
    public RefundPaymentController(ApexPages.StandardController st){
        hideButton = false;        
        paymnt = (Payment__c)st.getRecord();
        System.debug('this.paymnt==>'+paymnt);  
      
    }
    public static void refundProcess() {
       
        try{
            hideButton = true;
           paymentId = ApexPages.currentPage().getParameters().get('id');
          
            modalVisibility = false;
            Id purchaseOrderId = null;
           // System.debug('Reason_For_Refund==>'+Reason_For_Refund);
            System.debug('paymentId==>'+paymentId);

            if(paymentId != null){        
                
                System.debug('this.paymnt==>'+paymnt);
                purchaseOrderId=paymnt.Id; 
                if(purchaseOrderId != null){
                    checkRefundEligibility(purchaseOrderId,paymnt);
                }
            }
            hideButton = false;
        }catch(Exception ex){
            hideButton = false;
            System.debug('Exception ==> ' + ex.getMessage());
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, +'Method: refundProcess ==> ' + CONST_ERROR + ex.getMessage()));
        }
    }

and VF Page==>
<!-- <apex:page StandardController="Payment__c" extensions="RefundPaymentController" action="{!refundProcess}"> -->
<apex:page StandardController="Payment__c" extensions="RefundPaymentController" action="{!checkPermission}">
    <apex:slds />

    <apex:form >
        <apex:pageMessages id="showmsg"></apex:pageMessages>
    
        <div style=" {!if(modalVisibility == True,'display:block', 'display:none')}">
            <div style="height:640px">
                <section role="dialog" tabindex="-1" class="slds-modal slds-modal_x-small slds-fade-in-open" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1">
                    <div class="slds-modal__container">
                        <header class="slds-modal__header">
                            <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">Are you sure you want to refund the payment?</h2>
                        </header>
                        <div class="slds-modal__content slds-p-around_medium slds-p-left_large" id="modal-content-id-1">                            
                            <apex:pageBlock >
                                <apex:pageBlockSection columns="1">
                                    <apex:inputField value="{!Payment__c.Reason_For_Refund__c}" label="Reason for refund" required="true" id="Payment__c" style="width:200px" />                                    
                                    <apex:inputField label="Case number" value="{!Payment__c.Case_number__c}"  style="width:200px" />
                                </apex:pageBlockSection>
                            </apex:pageBlock>
                        </div>
                        <div class="slds-modal__footer">
                            <apex:commandButton styleClass="slds-button slds-button_brand" value="Yes" action="{!refundProcess}" onclick="this.onclick=function(){return false;}"/>
                            <apex:commandButton styleClass="slds-button slds-button_brand" value="No" action="{!redirectToPaymentRecord}" disabled="{!hideButton}"/>
                        </div>
                    </div>
                </section>
            </div>
            <div class="slds-backdrop slds-backdrop_open"></div>
        </div>
        <br/>
        <br/>
        <div style=" {!if(modalVisibility == True,'display:none', 'display:block')}">
            <apex:commandButton value="Back To Payment Record" action="{!redirectToPaymentRecord}"/>
        </div>
    </apex:form>

    <script>
        function disableOnSubmit(input) {
            var btn = input;
            setTimeout(function(){ 
                btn.disabled = 'disabled';
                // Use the Salesforce CSS style to make the button appear disabled
                btn.className = 'btnDisabled';
                //btn.value = "Saving..."; 
            }, 50);
        }
    </script> 
</apex:page>

please give me a suggestion to achieve this. Thanks in advance
 
AnkaiahAnkaiah (Salesforce Developers) 
Hi,

Refer the below links will help you to proceed further.
https://developer.salesforce.com/forums/?id=906F000000092VJIAY

Thanks!!