User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 391,709 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,377 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 1099 | Replies: 1
Reply
Join Date: Aug 2005
Posts: 26
Reputation: aish is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
aish's Avatar
aish aish is offline Offline
Light Poster

Help On Paste

  #1  
Dec 6th, 2005
I used this code for validate text box when user paste values to the text box.

//Browser Detection
var strUserAgent = navigator.userAgent.toLowerCase(); 
var isIE = strUserAgent.indexOf("msie") > -1; 
var isNS6 = strUserAgent.indexOf("netscape6") > -1; 
var isNS4 = !isIE && !isNS6  && parseFloat(navigator.appVersion) < 5; 


function Paste(objEvent) {
var objInput;
if (isIE) 
{
objInput = objEvent.srcElement; 
}
else 
{
objInput = objEvent.target;
}
if (!/^[A-Za-z0-9\s\£\$]*$/.test(objInput.value)) {
alert("The character you attempted to used is not allowed for this field.");
objInput.value = objInput.validValue || "";
objInput.focus();
objInput.select(); 
} else {
objInput.validValue = objInput.value;
}
}


It works in other characters but if I paste '£', program did not allow to paste it. How can I solove this problem.
Thanks. :cry:
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Posts: 26
Reputation: aish is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
aish's Avatar
aish aish is offline Offline
Light Poster

Re: On Paste

  #2  
Dec 6th, 2005
this is the answer,
if (!/^[A-Za-z0-9\s\xA3\$]*$/.test(objInput.value)) {
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb HTML and CSS Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the HTML and CSS Forum

All times are GMT -4. The time now is 3:04 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC