473,385 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Folder location validation

guys,

how do i check if the folder location the user is entering ends with a
\. and if it does not show and error and if does end with a \ process
the form.

thanks.

Sep 15 '06 #1
4 3657
pe******@gmail.com wrote:
guys,

how do i check if the folder location the user is entering ends with a
\. and if it does not show and error and if does end with a \ process
the form.
<input type="text" onblur="alert(/\\$/.test(this.value));">

Can you guarantee that the directory path *must* end with a "\"
character? In UNIX-based systems it is "/", for Mac OS 9 and earlier
it is ":". Other systems vary too. The best idea is to use a file
input and let the particular system work it out.

To allow for the systems noted above, your regular expression might be:

/[\\/:]$/
--
Rob

Sep 15 '06 #2
thanks. can you pls put that into a proper js statement. i am not sure
how to actually implement it.

Sep 15 '06 #3
cant get it to work. can someone help me pls.

Sep 15 '06 #4

pe******@gmail.com wrote:
cant get it to work. can someone help me pls.
Below is a small test. You'll note that using a file input requires
that an actual file is selected, users may have difficulty entering a
valid directory path.

Anyhow, if it's all too much, change the input type to 'text' and let
them copy/paste from Windows Explorer or a terminal window or whatever.

<title>Check path</title>

<script type="text/javascript">

function checkPath(form){
var path = form.divPath.value;
if (! /[\\/:]$/.test(path) ){
return confirm('The path you have entered is:\n' + path
+ '\nThis doesn\'t seem correct, it should end in'
+ ' "\\" or "/".'
+ '\nClick OK to send the path or Cancel to return'
+ ' to the form.');
}
}

</script>

<form action="" onsubmit="return checkPath(this);">
<p>Enter a directory path:<br>
<input type="file" name="divPath" size="100"><br>
<input type="submit" value="Submit path">
</p>
</form>
--
Rob

Sep 15 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: jenny | last post by:
Hi, I am trying to find a VB way that would create a folder on all existing drives - the folder name would be the same on each drive. ie c:\backup, d:\backup, etc. But the folders would only be...
1
by: Lukelrc | last post by:
Hi, I have a form containing (among other things) date fields for which i have a date validation script. What i need to happen is when the user presses the submit button the date validation...
0
by: pmud | last post by:
Hi, I had posted this question earlier also but got no suitable answer.The problem is that when I try to create a new project, the project gets created in a DEMO folder in wwwroot. When I hit...
3
by: Cuperman | last post by:
Hi all, I have an XML file that I reference in my windows application I access it using - Application.StartupPath & "/ini.xml" During development this resides in the Bin folder, it appears...
0
by: George Harig | last post by:
While building my deployment project I receive the following error Unable to build folder named "FOLDER_NAME". My projects compiles fine, the deployment project dose not. Are there any rules...
4
by: Ramakrishnan Nagarajan | last post by:
Hi, I am facing a different problem in my application. In that I am uploading a folder that contain only images. Everything was done and was working fine too. When I executed the application using...
3
by: spamsink42 | last post by:
hello how do i create a dialog to allow the user to choose a folder? i tried FolderBrowserDialog but encountered a couple of problems: - when you specify the starting location (property...
5
by: Noozer | last post by:
I'm looking for a "smart folder" program to run on my Windows XP machine. I'm not having any luck finding it and think the logic behind the program is pretty simple, but I'm not sure how I'd...
2
Airslash
by: Airslash | last post by:
Hi, I'm currently working on a function to delete a folder and its files + subfolders. The function currently works for the target folder, but refuses to delete the subfolders and files in the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.