Solved

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

Posted on 2014-09-11
2
160 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

821 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