Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 15th, 2003, 03:02 AM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Mimi
Default validating rich text field for attachment

Is it possible to validate a rich text field for attachments using javascript? If yes how? Please I've been working on this for more than 2 weeks already... Thanks!!!:D

Reply With Quote
  #2 (permalink)  
Old August 16th, 2003, 12:21 PM
Authorized User
 
Join Date: Jun 2003
Location: , , USA.
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to natmaster Send a message via AIM to natmaster Send a message via MSN to natmaster
Default

Yes!

Javascript:
validateForum() {
 if(document.forumName.inputName.value!="stuff") {
  alert('invalid entries');
 }
}

HTML:
<input type="submit" onClick="validateForum();">

----------------------------
Aeon of Darkness MUD - Free Online Roleplaying Game
http://aeonofdarkness.com
Reply With Quote
  #3 (permalink)  
Old August 20th, 2003, 07:54 PM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Mimi
Default

Thanks for the code! Unfortunately, it works even if only a string is in the rich text field and not an attachment. Is there a javascript code that specifically validates for attachment/s in a form? Thanks!

Reply With Quote
  #4 (permalink)  
Old August 21st, 2003, 04:17 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I don't know what rich text fields are in relation to web pages. Do you mean if an input box of type equal to 'file' has a value in it? If so then:
Code:
<form name="frmUpload" onsubmit="validateForm();">
<input type="file" name="txtFile">
<input type="submit">
</form>
<script>
function validateForm()
{
  if (document.frmUpload.txtFile.value = "")
  {
    alert("You have not selected a file to upload.");
    return false;
  }
  return true;
}


</script>

--

Joe
Reply With Quote
  #5 (permalink)  
Old August 25th, 2003, 03:12 AM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Mimi
Default

Thanks Joe! Yup, that was exactly what I needed.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rich Text Features austinf Pro JSP 1 December 20th, 2006 03:47 AM
Validating textbox in field level Paula222 Access VBA 5 February 15th, 2006 11:57 AM
Rich Text Box spike010101 Pro VB 6 1 September 29th, 2004 02:37 AM
Validating a hidden field mkerchenski ASP.NET 1.0 and 1.1 Basics 1 June 3rd, 2004 11:20 AM
Validating a form field against a database microchip Classic ASP Basics 2 April 24th, 2004 04:07 PM



All times are GMT -4. The time now is 08:14 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.