Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

javascript validation

javascript

  • Please log in to reply
4 replies to this topic

#1 dillyw82

dillyw82

    CC Newcomer

  • Member
  • PipPip
  • 15 posts
  • Programming Language:JavaScript
  • Learning:JavaScript

Posted 05 November 2012 - 05:12 PM

hi I have a assignment on javascript, im almost complete but I cant figure out why when I validate the message box it returns error even when a valid input is been put in any one got any suggestions ??

Attached Files


  • 0

#2 Vaielab

Vaielab

    Programming God

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1382 posts
  • Location:Quebec City
  • Programming Language:Java, C++, C#, PHP, JavaScript, Visual Basic .NET, Transact-SQL, ActionScript

Posted 05 November 2012 - 06:43 PM

I'm not sure to understand.
I downloaded your file, fill the form, and I didn't get any errors
It redirect me to Joes.html?name=cfadws&address=fewa&town=fdsa&state=QLD&postcode=5412&hphone=1234567891&wphone=1234567891&fax=1234567891&email=test%40spam.com&credit+card=AMEX&expiration_month=1&expiration_year=2012&product=cucumber&quantity=1&rad=on&street=&suburb=&state=QLD&postcode2=&message=Please+Enter+message+here

Everything I put in the form is there, and before I added everything I had alerts
  • 0

You can now stalk me on linkedin: http://ca.linkedin.c...elle/24/b44/88/ !


#3 dillyw82

dillyw82

    CC Newcomer

  • Member
  • PipPip
  • 15 posts
  • Programming Language:JavaScript
  • Learning:JavaScript

Posted 05 November 2012 - 08:35 PM

hey thanks for having a look its in the message box when I insert a message it still comes up with the alert telling me to enter a message
  • 0

#4 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts
  • Location:Argentina
  • Programming Language:C, C++, C#, PHP, JavaScript, Transact-SQL, Bash, Others
  • Learning:Java, Others

Posted 05 November 2012 - 10:10 PM

you just need to make a little change.

              if ( document.input.message.value == "" ||    document.input.message.value == "Please Enter message here"   )

there you go
  • 1

#5 dillyw82

dillyw82

    CC Newcomer

  • Member
  • PipPip
  • 15 posts
  • Programming Language:JavaScript
  • Learning:JavaScript

Posted 06 November 2012 - 12:26 AM

aha thanks for that :)
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download