Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Make sure the user does not enter or include the " " marks.

Posted on 2004-10-26
10
Medium Priority
?
127 Views
Last Modified: 2013-12-24
I have this validation that ask to user to enter "nda" if the data is not avalable.  But I want to get an alert to the user that if the "" marks are not required.

Can you please look at my code it is not working, coz i'm just starting to learn javascript

Thanks in advance

if (Form.Authority.value == "") || (Form.Authority.lenght > 3){
     alert("Please fill in  Authority information. \nIf data is not available, please
     type "nda" without the "" marks.");
     Form.Authority.focus();
     return false;
}

Thanks
0
Comment
Question by:mdbbound
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 8

Accepted Solution

by:
sigmacon earned 600 total points
ID: 12416744
mdbbound, you are asking javascript questions! the javascript forum may be more appropriate. here's my answer anyway. Note: be careful with your parentheses:

if (Form.Authority.value == "" || Form.Authority.lenght > 3 || Form.Authority.indexOf('"') > -1){
     alert("Please fill in  Authority information. \nIf data is not available, please
     type "nda" without the "" marks.");
     Form.Authority.focus();
     return false;
}
0
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 800 total points
ID: 12416873
You can handle in CF.

Don't bother the user with the fact that they have to leave out the " "
Instead just use Replace function to remove " if they add it.

That way the user doesn't get an error and neither does your system.
0
 

Author Comment

by:mdbbound
ID: 12416926
Hi

Can someone please move this Q to javascript.  Thanks
0
Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

 

Author Comment

by:mdbbound
ID: 12416967
Mrichmon,

Thanks for your suggestion, I think that is even better just in case the javascript is turned off. I just don't know the replace function yet.  If you think this Q should go to the javascript, please move it.

Thanks
0
 
LVL 17

Assisted Solution

by:Tacobell777
Tacobell777 earned 600 total points
ID: 12417108
I would not allow them to type in anything, if empty then you assume NDA, or put a checkbox next to the textfield, when ticked then consider it as NDA... What if they type in NAD or DNA ? The checks are endless, just use a checkbox, or leave empty.

Or use regular expressions to filter your data..
0
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 800 total points
ID: 12417111
No since I would do the Replace server side after it is submitted.....

Here is help:

http://livedocs.macromedia.com/coldfusion/6/CFML_Reference/functions-pt266.htm
0
 
LVL 8

Expert Comment

by:sigmacon
ID: 12417184
A) mdbbound, I answered your the specifc question, just wanted to let you know that you were asking JS-related questions!
B) mrichmon is, as usual ;-), right. Form validation should be performed on the server side NO MATTER WHAT
C) JavaScript can help improve the user experience, so it's ok to use it if you're getting paid for it
0
 
LVL 17

Expert Comment

by:Tacobell777
ID: 12417587
I seriously think that putting one check in place for " is not good enough, just think of how many other things could be entered wrong....
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 12423052
I think that all three of the following are good suggestions/points:

1) from sigmacon - a way to test in javascript...
2) from myself - a way to strip out the " in CF...
3) from Tacobell - use regular expressions or some other additional checks to catch any other situations you don't want....
0
 

Author Comment

by:mdbbound
ID: 12425955
Well,

I actually want javascript and CF server-side.  The problem is i don't know how to do it.  I will try all the suggestions.

Thanks, i will get back as soon as i can.
0

Featured Post

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question