You need to sign in to do that
Don't have an account?
Alex Wong 4
Is there a way to perform validation for apex:inputField?
I am creating a form in Visualforce. Since my form is a bit long, it is hard for users to remember the error message at the top and revise it. On top of the error message, I want to create a validation when users typing in their information.
For example, there are 2 field, users name and email. Users cannot leave the name field blank, if so, I want to show a message of "This field is required to fill in" beside the field. And for email field, I want to have another message to remind users to insert a valid email.
Is there anyway in visualforce to do so? Thanks for your help.
For example, there are 2 field, users name and email. Users cannot leave the name field blank, if so, I want to show a message of "This field is required to fill in" beside the field. And for email field, I want to have another message to remind users to insert a valid email.
Is there anyway in visualforce to do so? Thanks for your help.
You can add something like this:
1. Check the Empty
<apex:page id="page">
<script>
function show()
{
var name=document.getElementById('page:f1:p1:ip1').value;
if(name== "" || name==null)
{
document.getElementById("page:f1:p1:op2").innerHTML = "Please enter your name";
}
}
</script>
<apex:form id="f1">
<apex:pageblock id="p1">
<apex:outputlabel value="Enter u r name" id="op1" />
<apex:inputtext id="ip1" />
<apex:commandbutton value="submit" onclick="return show();" reRender="op2"/>
<apex:outputlabel id="op2" />
</apex:pageblock>
</apex:form>
</apex:page>
---> Besides salesforce has the on field validation, so u can have that option.
2. create formula syntax
Regression : '([a-zA-Z0-9_\\-\\.]+)@(((\\[a-z]{1,3}\\.[a-z]{1,3}\\.[a-z]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3}))'
Thanks
Aniket
All Answers
You can have a Javascript to check the require field & for proper email format you can use regression expression.
Thanks
Aniket
* if you find the reply FINE. Please like
You can add something like this:
1. Check the Empty
<apex:page id="page">
<script>
function show()
{
var name=document.getElementById('page:f1:p1:ip1').value;
if(name== "" || name==null)
{
document.getElementById("page:f1:p1:op2").innerHTML = "Please enter your name";
}
}
</script>
<apex:form id="f1">
<apex:pageblock id="p1">
<apex:outputlabel value="Enter u r name" id="op1" />
<apex:inputtext id="ip1" />
<apex:commandbutton value="submit" onclick="return show();" reRender="op2"/>
<apex:outputlabel id="op2" />
</apex:pageblock>
</apex:form>
</apex:page>
---> Besides salesforce has the on field validation, so u can have that option.
2. create formula syntax
Regression : '([a-zA-Z0-9_\\-\\.]+)@(((\\[a-z]{1,3}\\.[a-z]{1,3}\\.[a-z]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3}))'
Thanks
Aniket
However, nothing happen even I follow him. Is your method show the similar function to the link?
Thanks for your help!!!
Geektechboy.com
Newstatus.in (https://newstatus.in/sad-status-hindi/)
This is very useful information for me. Thank you very much!
My work : homework for you (https://homeworkfor.me)
For this website: https://street-view.org/
Myxer Free Ringtones (https://myxerfreeringtonesdownload.com/) App Download 2020 ringback tones wallpapers for Android, iOS my Myxer Free Music Ringtones (https://myxerfreeringtonesdownload.com/free-music-ringtones-for-android/)
Geometry Dash (https://geometrydashmodapk.wordpress.com/), Geometry Dash (https://geometrydashmodapk.blogspot.com/), Geometry Dash (https://geometrydashhapk.wixsite.com/geometrydash), Geometry Dash (https://geometrydashmodapk.weebly.com/), Geometry Dash (http://geometrydash.jigsy.com/),
There are various subscriptions offered by the antivirus software Norton. Norton is capable of protecting all your handheld devices and computers. The antivirus software programs provide a comprehensive solution for all your needs related to cybersecurity. Moreover, the program offers a quick check for new viruses within every five to fifteen minutes, along with removing them. The innovative technology used in Norton prevents the keyloggers from tracking your online data. The wide range of Norton setup available at www.norton.com/setup keep all your data safe, including files and applications.
Visit More:
norton.com/setup (https://publicblogs.co.uk/norton-setup)
norton.com/setup (https://my-blog-search.com/norton-setup/)
office.com/setup (https://internet-blogs.com/office-setup/)
mcafee.com/activate (https://ramcafee.webflow.io/)
https://webdomaingenerator.com Instantly bookyour domain name using by webdomain name generator
Webdomain Name Generator (https://webdomaingenerator.com) Instantly bookyour domain name using by webdomain name generator