1

I want to disable multiple apex:inputText.
1.Click the checkbox.
2.I want to Disable inputText.

I can disable single inputText.
But, I can't assigne the same id to other apex:inputText.
What should I do?

<apex:page controller="EntryController" showHeader="true" sidebar="false" title="サンプル" docType="html-5.0" id="page" tabStyle="Account"  >

<apex:sectionHeader id="header" title="サンプル"/>
<apex:form >
    <div id="all">
        <div id="form">
            <apex:outputPanel >
                <apex:pageBlock title="配送先">
                    <apex:pageBlockSection >
                        <apex:inputField value="{!newContract.isShippingSame__c}">
                            <apex:actionSupport reRender="isSame" event="onchange" />
                        </apex:inputField><div/>
                        <apex:inputText value="{!newContract.ShippingAddressee__c}" label="発送先名" id="isSame" disabled="{!newContract.isShippingSame__c}" /><br/>
                        <apex:inputText value="{!shippingPostalcode}" label="郵便番号" />
                        <apex:inputText value="{!shippingState}" label="住所にする"/>
                        <apex:inputText value="{!newContract.RecieverName__c}" label="受取者名" />
                        <apex:inputText value="{!newContract.RecieverPhone__c}" label="受取者TEL" />                        
                    </apex:pageBlockSection>
                </apex:pageBlock>
            </apex:outputPanel>
        </div>
    </div>

</apex:form>

EntryController.apxc

    public class EntryController {

        public Contract__c newContract{get; set;}
        public String shippingPostalcode{get; set;}
    public String shippingState{get; set;}

        // コンストラクタ
        public EntryController(){
            this.newContract=new Contract__c();
            this.newContract.isShippingSame__c=false;
       this.shippingPostalcode='';
          this.shippingState='';
        }
    }

enter image description here

2

You can disable the individual inputText's by reRendering all the inputText's again by passing comma separated Id's in the reRender attribute of actionSupport.

<apex:pageBlockSection >
    <apex:inputField value="{!newContract.isShippingSame__c}">
        <apex:actionSupport reRender="isSame1,isSame2,isSame3,isSame4,isSame5" event="onchange" />
    </apex:inputField><div/>
    <apex:inputText value="{!newContract.ShippingAddressee__c}" label="発送先名" id="isSame1" disabled="{!newContract.isShippingSame__c}" /><br/>
    <apex:inputText value="{!shippingPostalcode}" label="郵便番号" id="isSame2" disabled="{!newContract.isShippingSame__c}"/>
    <apex:inputText value="{!shippingState}" label="住所にする" id="isSame3" disabled="{!newContract.isShippingSame__c}"/>
    <apex:inputText value="{!newContract.RecieverName__c}" label="受取者名" id="isSame4" disabled="{!newContract.isShippingSame__c}"/>
    <apex:inputText value="{!newContract.RecieverPhone__c}" label="受取者TEL" id="isSame5" disabled="{!newContract.isShippingSame__c}"/>                        
</apex:pageBlockSection>
  • by passing comma! I see. Thank you so much ! – yuko-kisa9 Mar 27 at 1:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.