Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
1.50/5 (4 votes)
See more:
User inputs a text in my text field. If his text matches a text in my "list," he is sent to a specific URL once he hits the submit button.

I want mine to determine the user's text input from a list I provide. My list will have a lot of texts/urls and it will continue to grow, so I want to be able to edit the list

Example:
input text: aaaa, go to URL1
input text: mmne, go to URL2
input text: lhfj, go to URL3
input text: tigf, go to URL4
input text: gred, go to URL5

Can anyone help me with this please?
Posted
Comments
[no name] 22-Sep-15 0:52am    
When you says text from a list what is that in Javascript like arary or anything else. Secondly when do you want to check text box value on onclick of a button or onblur of text box.
RelicV 22-Sep-15 1:38am    
Suggestion - Do some R&D and put some effort in developing the code. We are here to help you, not to do your work. Dont take it in a negative way. :)
F-ES Sitecore 22-Sep-15 13:11pm    
Google "javascript multi-dimensional arrays" to work out how you hold a list of strings and target urls, or you could hold a single-dimensional array of json objects; "javascript array json objects". Google "javascript read input text on change" to find out how to get the data in the textbox, and "javascript redirect to url" to work out how to redirect the user. Once you know how to do each bit simply put them all together. If you have a specific question about something you are stuck on then feel free to ask.

1 solution

Since the list is made of fixed value which you will control then a text box is all wrong. You need a <select> list.

Use these to dispatch to one of the javaScript functions to change pages, such as location.assign().

The coding, however, is up to you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900