You need to sign in to do that
Don't have an account?

Hide a button upto click another button
Hi Everyone,
I have two buttons checkformat,search.I want to disable my search button untill user check for his format with checkformat button.I'm using a javascript to check the format of my inputtext.
Here is my code,
<apex:panelGroup >
<apex:inputText id="searchText" value="{!searchText}" onblur="checkingstring(this)"/>
<button onclick="alert('Correct Format !');">CheckFormat</button>
<apex:commandButton value="Search" action="{!search}" rerender="resultsBlock" status="status" disabled="true"/></apex:panelGroup>
<script>
function checkingstring(searchText){
var regexp = /^[A-Z]{2}\d{4}-\d{5}$/i; //AANNNN-NNNNN A = Capital N = Number
if (!regexp.exec(searchText.value)) {
alert("The syntax is always as follows: AANNNN-NNNNN (A= Alpha/Letter; N= Number) i.e.FL0301-12345</b>");
}
}
</script>
for my search button it will search for the text on the object if it is not on object it will create a record with the searchtext and it will display thwe record in edit mode to update some of the values..if the record exists it will simply displays the record..
public pagereference search(){
/// code goes here
}
Search should be enable only when the text is in correct format....
I solved your problem using jQuery.
At the top of you page add
Then I changed you function to
Then modify your Apex a bit
The addition there was the id on <apex:commandButton>
That gives you what you're looking for.
Hi ryan,
Thanks for your help.It's not working in my case the search button is always disable and the checkformat always giving the correct format alert only, for worng format text also.
Need to change the class, btn in above line