function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Im trying to validate the visual force page using the javascript [ not the JQUERY ],
Can any one suggest a good code to validate a text box ,,,,
General code such as
1--document.form.field_id.value----------- THIS IS NOT WORKING.....
2--getElementById('field_id')------------THIS IS NOT WORKING EITHER........
So suggest something better ...........Thanks in Advance .....
Regards,
Pranav
does every element in your VF page have an ID?you may need to select it like thepage:theform:theelement:theitem and drill down to it.
This issue is exaclty why I use JQUERY, much eaiser...
Try with
getElementById('{!$component.field_id}')
Regards
sorry mate ,it didn go well......
try better if possible ,thnx agaain
I want to validate the textBox on button click ...... using JAVASCRIPT
SOLUTION FOR THIS PLEASE..... HOW TO VALIDATE this TxtBOX
<script type="text/javascript"> function abcd() { var temp=document.getElementById('txtOrgName'); if(temp==null||temp=='') { alert("Empty Organization Name"); return false; } }</script><apex:form id="formPranav">
<td>Oraganization Name :</td> <td><apex:inputText id="txtOrgName" value="{!str_OrgName}"/></td></apex:form>
//BUTTON AS FOLLOWS
<apex:commandButton onclick="abcd()" value="Save" action="{!save}"/>
Try
<script type="text/javascript"> function abcd() { var temp=document.getElementById('{!$component.formPranav.txtOrgName}').value; if(temp==null||temp=='') { alert("Empty Organization Name"); return false; } } </script> <apex:form id="formPranav"> <td>Oraganization Name :</td> <td><apex:inputText id="txtOrgName" value="{!str_OrgName}"/></td> </apex:form>
I want to validate the textBox on button click ......
ANY JQUERY SOLUTION.............
Try this
<script type="text/javascript"> function abcd() { var temp=document.getElementById('{!$component.formPranav.txtOrgName}').value; if(temp==null||temp==''){ alert("Empty Organization Name"); return false; }else{ return true; } }</script><apex:form id="formPranav"> <td>Oraganization Name :</td> <td><apex:inputText id="txtOrgName" value="{!str_OrgName}"/></td></apex:form>
and this for the button
<apex:commandButton onclick="if(!abcd()) return false;" value="Save" action="{!save}"/>
This is a javascript solution
<script type="text/javascript"> function abcd(id) { var temp=document.getElementById(id).value; if(temp==null||temp=='') { alert("Empty Organization Name"); return false; } else { validatedAction(); } } </script> <apex:form id="formPranav"> <apex:actionFunction name="validatedAction" action="{!save}" /> <td>Oraganization Name :</td> <td><apex:inputText id="txtOrgName" value="{!str_OrgName}"/></td> </apex:form> <apex:commandButton onclick="abcd('{!$Componenet.txtOrgName}')" value="Save" />
For more refer : http://www.salesforceworld.blogspot.com/2011/06/javascript-with-visualforce-pages.html
http://www.salesforceworld.blogspot.com/2011/06/parameter-passing-using.html
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
does every element in your VF page have an ID?you may need to select it like thepage:theform:theelement:theitem and drill down to it.
This issue is exaclty why I use JQUERY, much eaiser...
All Answers
Try with
Regards
sorry mate ,it didn go well......
try better if possible ,thnx agaain
does every element in your VF page have an ID?you may need to select it like thepage:theform:theelement:theitem and drill down to it.
This issue is exaclty why I use JQUERY, much eaiser...
I want to validate the textBox on button click ...... using JAVASCRIPT
SOLUTION FOR THIS PLEASE..... HOW TO VALIDATE this TxtBOX
<script type="text/javascript">
function abcd()
{
var temp=document.getElementById('txtOrgName');
if(temp==null||temp=='')
{
alert("Empty Organization Name");
return false;
}
}
</script>
<apex:form id="formPranav">
<td>Oraganization Name :</td>
<td><apex:inputText id="txtOrgName" value="{!str_OrgName}"/></td>
</apex:form>
//BUTTON AS FOLLOWS
<apex:commandButton onclick="abcd()" value="Save" action="{!save}"/>
Try
Regards
Try this
and this for the button
Regards
This is a javascript solution
For more refer : http://www.salesforceworld.blogspot.com/2011/06/javascript-with-visualforce-pages.html
http://www.salesforceworld.blogspot.com/2011/06/parameter-passing-using.html
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.