473,327 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

two actions, one text field, two dropdowns, multiple inputs

So I'm trying to create a search box that has two choices based on a drop down box. Each selection does a different form action. On top of that, based on the selection made, it has different input values.
something like this:

Expand|Select|Wrap|Line Numbers
  1. <form name="search" action="ACTION1 or ACTION2">
  2. <select name="group">
  3. <option value="1234">Selection 1</option>
  4. <option value="6789">Selection 2</option>
  5. <input type="image" src="search.gif" alt="search button" />
  6.  
  7. if Selection 1 is selected it gets action - "ACTION1.php" and
  8. <input type="hidden" name="direct" value="true">
  9. <input type="text" name="bquery" size="24"  value="">
  10. <input type="hidden" name="AuthType" value="ip,cpid">
  11. if Selection 2 is selected it gets action - "ACTION2.php and
  12. <input type="hidden" name="outside" value="true">
  13. <input type="hidden" name="AuthType" value="wow, pow">
  14. <input name="term" type="text" size="24">
I'm a real NOOB when it comes to javascript - so any help would be greatly appreciated
Jan 27 '10 #1
1 2085
There are several ways to do this, but the easiest would be this:

Expand|Select|Wrap|Line Numbers
  1. <form name="search">
  2. <select name="group" onchange="updateForm()">
  3. <option value="1234">Selection 1</option>
  4. <option value="6789">Selection 2</option>
  5. </select>
  6. <div id="content"></div>
  7. <input type="image" src="search.gif" alt="search button" onclick="document.forms[0].submit();">
  8. </form>
  9. <script type="text/javascript">
  10. function updateForm()
  11. {
  12. if(document.forms[0].group.value=="1234")
  13. {
  14. document.getElementById("content").innerHTML="<input type='text' name='bquery' size='24'  value=''>";
  15. document.forms[0].action.value="ACTION1";
  16. }
  17. else
  18. {
  19. document.getElementById("content").innerHTML="<input type='text' name='term' size='24'  value=''>";
  20. document.forms[0].action.value="ACTION2";
  21. }
  22. }
  23. </script>
Jan 27 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to...
7
by: Randell D. | last post by:
Folks, I am working on a contact db using PHP and MySQL. My results so far outputs a slimed down version of records to the browser. I would like to implement a method whereby the user can...
20
by: Dannyboyo | last post by:
I have what I hope is a simple request. I can't really code in javascript, but I am pretty good at cusomizing it with slight modifications. I code in ASP and HTML. I am trying to capture customer...
5
by: simon_s_li | last post by:
Hi, I have 5 fields in line where I need to drag and drop the text from one field to another field and then all the fields need to re-order themselves. So for instance if I drag the text in...
3
by: Damon | last post by:
I am working on a site in which I would like to have two dropdowns that will allow a user to navigate through the administrative pages of the site. The first would allow the user to choose the...
6
by: The Eeediot | last post by:
Hello, Folks... I'm almost becoming a regular to this newsgroup. I am trying to display the contents of an MS-SQL Text field to a TextBox in ASPdotNET. The text in this field contains all...
1
by: Andy | last post by:
What I want to do is to populate multiple dropdowns when editing. Presumably... a) I should use a DataReader so that I can get each ResultSet for each dropdown control, and that should cut down...
6
by: James | last post by:
Have a textbox that's in Password mode on a user creation page. Have several dropdowns that cause a PostBack out of necessity on this page. I cannot separate them. When one of these dropdowns...
1
by: pushrodengine via AccessMonster.com | last post by:
Is there a way to log user actions? What I would like is to be able to log user activities within the database. The table “tblUserEvents” would contain two fields. Field one “EventTime”...
1
by: jpreston | last post by:
I am wanting to minimize the number of text fields on my page and would like to reduce the city, state, and zip fields into one "location" text field (ex. yellowbook.com's "Location" text box). I'm...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.