Print Page | Close Window

JS question

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Web Design Discussion
Forum Description: Discussion on web design and development subjects.
URL: https://forums.webwiz.net/forum_posts.asp?TID=15513
Printed Date: 28 March 2026 at 11:07pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: JS question
Posted By: bootcom
Subject: JS question
Date 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



Replies:
Posted By: ub3rl337ch3ch
Date 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.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net