Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-09-11
2
Medium Priority
?
168 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 53

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 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 53

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

704 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