Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Alert tex on web form

    Hi this is my first post, I am a total beginner at web design and come from a purely networking background. I have been assigned the task of creating an email form to send data submitted to the user to one of my inboxes. That wasnt too bad and i managed to get that working in a few hours but now i am adding the final touches to it i have came to a stand still. I would like to be able to use CSS to make red text appear next to an input box if the user hasnt entered data into this box and i dont know where to start? can anybody on here offer any tips or advice?

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    Search: form validation

    It highly depends on what you're using to handle your stuff. For example, if using .net, you'd use a Validator. If using PHP, you usually just check each field with regular expressions. If it's an internal application you are often safe with just client-side javascript, but if this is external, javascript is too easily disabled to be relied upon as the sole validation method.

    It has little to do with HTML and belongs in the forum of the language you're using to develop your app.
    If you're just using pure html with mailto as the form action, there's all sorts of things wrong with that.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,387
    Thanks
    32
    Thanked 288 Times in 282 Posts
    As mentioned, you can do this on the client side via JavaScript. I ended up doing what you requested for practice but it came out as something that doesn’t work in Internet Explorer. The styling is a bit messed up in Firefox as well though, since I used something from CSS2.1 that that browser doesn’t support. So, in the end it only displays properly in Opera 9. If you’re interested in trying to learn something from it anyway, it can be found here.
    For every complex problem, there is an answer that is clear, simple, and wrong.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •