Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - JS question
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedJS question

 Post Reply Post Reply
Author
bootcom View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 February 2005
Location: United Kingdom
Status: Offline
Points: 259
Direct Link To This Post Topic: JS question
    Posted: 19 June 2005 at 8:58pm
I have a form field, that is populated by user input. However, the user has the ability to populate the form field with additional pre-defined text from a drop down box using an onchange trigger.
 

input.value = dropdown.value + input.value
 
However, obviously using this method, the user could then accidentally (or purposefully) have a line filled of predefined text from the drop down. How do I check (possibly using arrays maybe) using client side (and cross browser js) that the user is not repeating stuff from the drop down?
 
Once thing of note is that each listing in the dropdown is one word, begining with a /, if that helps any.
 
Cheers
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Direct Link To This Post Posted: 19 June 2005 at 10:41pm
whenever a value is selected from the dropdown, you could flag a var specific that that value and check for the flag each time. if it's there, it doesn't  get added to input.value again.
 
That would stop them selecting the same value from the dropdown again and again (if that's even an issue). to stop the user input from being the same as that from the dropdown boxes, you could just do an if x != y { where x and y are the separate values... but both these methods would be rather longwinded. They're here though if you can't figure anything better.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.