You need to sign in to do that
Don't have an account?
aaaaaaaaaaa
How to disable input fields when i enter a text value in another input field
Hi,
I have 6 input fields in which 4 are input text ( say IT1,IT2,IT3,IT4) field and 2 are select list field.(say SL1 ,SL2)
if i try to enter a text value in my IT1 field all the other fields (IT2,IT3,IT4,SL1,SL2) should be disabled in my vf page.
Can someone please help on this.your help will be very much appreciated.
Thanks in advance
I have 6 input fields in which 4 are input text ( say IT1,IT2,IT3,IT4) field and 2 are select list field.(say SL1 ,SL2)
if i try to enter a text value in my IT1 field all the other fields (IT2,IT3,IT4,SL1,SL2) should be disabled in my vf page.
Can someone please help on this.your help will be very much appreciated.
Thanks in advance
Here is a handy resource: http://www.tehnrd.com/how-to-disable-visualforce-inputfields/
one more thing i wanted to ask you :
i want to disable the other fields when i start entering a text value in my text field, what actionsupport event should i use on my text field ?
Another thing when i press backspace and clear the complete text ( now no text present in my text box) the disabled field should again be enabled.How do i do this?
Thanks in advance
for eg:
IN VF PAGE
<apex:pageBlockSectionItem >
<apex:inputText id="searchOppName" value="{!searchOppName}" />
<apex:actionSupport event="onkeypress" action="{!testac}" reRender="oppName"/
</apex:pageBlockSectionItem>
<apex:outputPanel id="oppName" >
<apex:inputText id="searchAccName" value="{!searchAccName}" />
<script>document.getElementById('{!$Component.searchrAccName}').disabled = {!testabc}; </script>
</apex:outputPanel>
IN CLASS
public void testac(){
testabc = true;
}
Can you please help me on this? The searchAccName is not getting disabled.
--Akram
My scenario is when i ener a text value in field IT2 (input text) all others fields should be disabled ,it should work as in the above example shared by you.
VF PAGE:
<apex:pageBlock >
<apex:pageBlockSection columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel value="IT1" for="OppName"/>
<apex:inputText id="OppName" value="{!OppName}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="IT2" for="OppAccName"/>
<apex:inputText id="OppAccName" value="{!OppAccName}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="IT3" for="BookDate"/>
<apex:inputField id="BookDate" value="{!Opp.Date}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="IT4" for="Bookstage"/>
<apex:selectList id="Bookstage" value="{!BStage}" size="1" required="false">
<apex:selectOptions value="{!stages}"/>
</apex:selectList>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem rendered="{!IsProfile}">
<apex:outputLabel value="IT5" for="BookStatus"/>
<apex:selectList id="BookStatus" value="{!BStatus}" size="1" required="false">
<apex:selectOptions value="{!BStatuses}"/>
</apex:selectList>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
Reply appreciate if you could help on this
Thanks
Put this code inside your page tag,