Solved

Based on response in a form display additional form data and then submit responses to database

Posted on 2014-09-11
2
158 Views
Last Modified: 2014-09-12
I have a form that collects personal information and then based on one field selection (field: RequestType), additional data fields are displayed and eventually all data is sent to an MSAccess database. I do not understand how to display the additional data on the same page after the selection of the RequestType. I did have the form working when the additional request types were not needed.

Code is attached.
Request.txt
0
Comment
Question by:Malloy1446
  • 2
2 Comments
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 40318308
You will want to do this client side although you could do it sever side but that would be a page refresh.  This is a more modern way.
http://jsbin.com/kolamawejive/1/edit?html,output
<!DOCTYPE html>
<html>
<head>
  <style>
    .chooseJournal,.chooseBook{display:none;}
  </style>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
  <script>
    $(function(){
  $(" input[name='ILLRequestType']").click(function(){
    var type=$(this).val();
    if(type==="Journal Article"){
       $('.chooseJournal').show();
      $('.chooseBook').hide();
       
    }
    if(type==="Book"){
       $('.chooseJournal').hide();
      $('.chooseBook').show();
       
    }
    
  })
  
})
  </script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
<form method="POST" action="Submit.asp" onsubmit="return validateForm()" name="FrontPage_Form1">


<!-------------------- PERSONAL INFORMATION -------------------->

	<p><b>First Name:&nbsp; </b>
	<input type="text" name="RequestorsFName" size="100"></p>
  
	<p><b>Last Name:&nbsp; </b>
	<input type="text" name="RequestorsLName" size="100"></p>
  
	<p><b>Email:&nbsp;</b>
	<input type="text" name="RequestorsEmail" size="75"></p>

	<p><b>Phone Number:&nbsp;</b>
	<input type="text" name="RequestorsPhone" size="75"></p>



<!------------------------------------ TYPE OF REQUEST ------------------------------------>
<!-------------------- BASED ON RESPONSE, APPROPRIATE FORM WILL DISPLAY -------------------->
  
	<p><b>Type of Request:&nbsp;</b>
	<blockquote>
		<input type="radio" name="ILLRequestType" value="Journal Article">Journal Article<br>
		<input type="radio" name="ILLRequestType" value="Book">Book<br>
		<input type="radio" name="ILLRequestType" value="Audiovisual">Audiovisual
	</blockquote>



<!------------------------------------ BOOK REQUEST ------------------------------------>
<!---- IF BOOK SELECTED, FOLLOWING DATA IS COLLECTED -------------------->
<div class="chooseBook">
	<p><b>Author/Editor:&nbsp; </b>
	<input type="text" name="ILLBookAuthor" size="100"></p>
  
	<p><b>Title:&nbsp; </b>
	<input type="text" name="ILLBookTitle" size="100"></p>
  
	<p><b>Publisher:&nbsp; </b>
	<input type="text" name="ILLBookPublisher" size="100"></p>
  </div>


<!--  JOURNAL ARTICLE REQUEST --->
  <div class="chooseJournal">
<!-- - IF JOURNAL ARTICLE IS SELECTED, FOLLOWING DATA IS COLLECTED --->

	<p><b>Journal Title:&nbsp; </b>
	<input type="text" name="ILLJournalTitle" size="100"></p>
  
	<p><b>ArticleTitle:&nbsp; </b>
	<input type="text" name="ILLJournalArticle" size="100"></p>
  
	<p><b>Publication Date:&nbsp; </b>
	<input type="text" name="ILLJournalPubDate" size="100"></p>
  </div>


<input type="hidden" name="SubmitDate" value="<%=Date()%>">
<input type="hidden" name="ChartID" value="<%=session("ChartID")%>">
<input type="submit" value="Submit Request">

</form> 


</body>
</html>

Open in new window

0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 40318311
If you want to do it server side, you would add each item in a separate form.

<form name="form1">

Main form info

</form>
<%
if request.form("somevalue")="Book" then
%> 
<form name="book">
Book Form
</form>
<%end if%>

Open in new window

0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now