Hi Sean,
I indeed did it via regular expressions:)
Here is the final code:
$("input#title").keyup(function(){
var oldVal = $(this).val();
oldVal = oldVal.toLowerCase();
newFolder = oldVal.replace(/^\s+|\s+$/g,"").replace(/[
_:&;\"']/g,"-").replace(/[*'²"+!?\/@°\]\[<>]/g,"").replace(/[éèë]/g,"e").replace(/[ï]/g,"i").replace(/[äà]/g,"a").replace(/[ùûü]/g,"u");
$("input#project_folder").val(newFolder);
});
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sean O
Sent: jeudi 8 mars 2007 18:37
To: [email protected]
Subject: Re: [jQuery] generate folder name
Alexandre,
You should be able to simply test the folder name string against a regular
expression.
More info:
http://www.regular-expressions.info/javascript.html
http://www.websina.com/bugzero/kb/regexp.html
HTH,
________
SEAN O
http://www.sean-o.com
Alexandre Plennevaux wrote:
>
> hello!
>
> i am creating a form where user enters the name of a new project.
> First field is "title", the second one is "project folder name".
> I would like to proposed a failsafe folder name from the project title.
> Can somebody provide me with a good idea on how to generate a secure
> folder name out of any string input, thus removing all non
> alphanumeric characters ?
>
>
> Thank you!!
>
> Alexandre
>
> --
> Ce message Envoi est certifié sans virus connu.
> Analyse effectuée par AVG.
> Version: 7.5.447 / Base de données virus: 268.18.7/712 - Date:
> 6/03/2007
> 15:42
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>
--
View this message in context:
http://www.nabble.com/generate-folder-name-tf3361720.html#a9374260
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
--
Ce message Envoi est certifié sans virus connu.
Analyse effectuée par AVG.
Version: 7.5.447 / Base de données virus: 268.18.7/713 - Date: 7/03/2007 9:24
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/