Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 13th, 2003, 11:22 PM
Registered User
Join Date: Jul 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to meiyeen
Default Displaying field selection


I have a form that saves input by users. There is a mixture of textboxes and 5 drop down selection menus. 2 of the select menus are linked. One is to select the type of inventory and the other the category of inventory. When a user selects a 'Type', for example; 'Tools' then the category part will list down all that has to do with tools only, instead of displaying all the categories in one go. The purpose is to ease the selection of category.

To show this I used the onSubmit() function on the 'Type' select. Each time the user select an option the page will refresh. This causes all the entries in the textboxes to clear as well. If i add in the action="page.asp" into the form section, each time the 'Type' is selected then the page is submitted as well. This is a section of my code. Please hrlp and advice.


<FORM id="form1" name="form1" method="post" action="form2.asp">
<input type="text" name="Item" size="17">

<SELECT name="types" OnChange="form1.submit();">
<option name="XYZ" value="-">Select a type</option>
<% Types.MoveFirst
   Do While Not Types.EOF
      Response.Write "<option value=" &Types("type_id")& ">" & Types ("type_name")

selectItem( form1.types );

function selectItem( sel )
var i
for( i = 0; i < sel.options.length; i++ )
if(sel.options[i].value == <%= "'" & Request.form("types") & "'" %> )
sel.options[i].selected = true;

<SELECT name="category">
<option name="ABC" value="-">Select a category</option>
  Do While Not Cat.EOF
    if Cat("type_id") = Cint(Request.Form("types")) Then
       Response.Write "<option value =" & Cat("cat_id")& ">" & Cat("cat_name")
    end if

<INPUT type="submit">

Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying hierarchical data for selection Broodmdh Classic ASP Basics 9 August 27th, 2008 08:18 PM
Memo field not displaying meichmann SQL Server ASP 3 August 31st, 2006 11:36 AM
Populate field names upon selection from 1st DDL? InsouciantCoquette Classic ASP Databases 0 February 26th, 2006 11:23 PM
Newbie-Access question-selection of entire field franzwil Access 3 September 27th, 2004 09:28 AM
Getting data based on field selection Trojan_uk Classic ASP Basics 1 December 9th, 2003 10:47 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.