Solved

Extra commas generated when displaying results from form

Posted on 2015-01-10
2
74 Views
Last Modified: 2015-01-17
I have a form with an option for the user to select three options. Based on the option selected, user fills out option specific fields. There are also two fields which are available in all three options (ILLNotNeeded and ILLInfo). Code then submits the data to the database and displays a confirmation page with all data. The issue I am having is for these two fields it it displaying extra commas.

Following is the code for the request form.
<style>
	.chooseJournal,.chooseBook,.chooseAudiovisual{display:none;}
</style>

<script src="//code.jquery.com/jquery-1.11.1.min.js">
</script>

<script>

	$(function()
		{
		$('#btnSubmit').hide();
		$('#btnClear').hide();
		$(" input[name='ILLRequestType']").click(function()
		
		{
		var type=$(this).val();
		
			if(type==="Journal Article"){
				$('.chooseJournal').show();
				$('.chooseBook').hide();
 				$('.chooseAudiovisual').hide();
 				$('#btnSubmit').show();
 				$('#btnClear').show();
      
    		}
    		if(type==="Book"){
       			$('.chooseJournal').hide();
      			$('.chooseBook').show();
 				$('.chooseAudiovisual').hide();
 				$('#btnSubmit').show();
 				$('#btnClear').show();

    		}
    		if(type==="Audiovisual"){
       			$('.chooseJournal').hide();
      			$('.chooseBook').hide();
 				$('.chooseAudiovisual').show();
 				$('#btnSubmit').show();
 				$('#btnClear').show();
    		}
    
})
  
})

</script>



<!-------------------------------------------------------------------------------------------->
<!------------------------------------ Continue the code ------------------------------------->
<title><%=title%></title>

<body>

<div id="CenterTwo">

<h2><%=title%></h2>  

<b>Location: VISN <%=session("VISNID")%> -- <%=session("FacName")%> (<%=session("City")%>, <%=session("State")%>)</b>



<!-------------------------------------------------------------------------------------------->
<!---------------------------- Information related to Eligibility ---------------------------->

<p>It is simple to request a book, audiovisual or an article from a journal. Complete the 
personal information, select the type of request, complete the fields as displayed and then 
click the submit button. Request will be forwarded to library staff for 
processing. If you have questions, contact your local library staff.
<br>


<%
'response.Write("chartID: " & session("ChartID"))
'response.End()
%>

<hr>



<form method="POST" action="Eligible2.asp" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript">



<!-------------------------------------------------------------------------------------------->
<!----------------------------- REQUESTOR'S PERSONAL INFORMATION ----------------------------->

<p><b>First Name:&nbsp; </b>
<!--webbot bot="Validation" s-display-name="First_Name" b-value-required="TRUE" i-minimum-length="3" i-maximum-length="250" -->
<input name="ILLRequestorsFName" type="text" size="100" maxlength="250" value="<%=Request("ILLRequestorsFName")%>"></p>
  
<p><b>Last Name:&nbsp; </b>
<!--webbot bot="Validation" s-display-name="Last_Name" b-value-required="TRUE" i-minimum-length="3" i-maximum-length="255" -->
<input name="ILLRequestorsLName" type="text" size="100" maxlength="255" value="<%=Request("ILLRequestorsLName")%>"></p>
  
<p><b>Service:&nbsp;</b>
<input name="ILLRequestorsService" type="text" size="75" value="<%=Request("ILLRequestorsService")%>"></p>

<p><b>Email:&nbsp;</b>
<!--webbot bot="Validation" s-display-name="Email" b-value-required="TRUE" i-minimum-length="5" -->
<input name="ILLRequestorsEmail" type="text" size="75" value="<%=Request("ILLRequestorsEmail")%>"></p>

<p><b>Phone Number:&nbsp;</b>
<input name="ILLRequestorsPhone" type="text" size="75" value="<%=Request("ILLRequestorsPhone")%>"></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/Book Chapter<br>
	<input type="radio" name="ILLRequestType" value="Audiovisual">Audiovisual (Audiocassette, DVD, etc)
</blockquote>
<hr>
Please submit as much information as possible and use the additional information field as 
needed. Incomplete information will delay filling your requests.



<!------------------------------------------------------------------------------------------->
<!------------------------------------- BOOK REQUEST ---------------------------------------->
<!-------------------- IF BOOK SELECTED, FOLLOWING DATA IS COLLECTED ------------------------>
<div class="chooseBook">
<hr>

	<p><b>Author or 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>ISBN:&nbsp; </b>
	<input type="text" name="ILLBookISBN" size="25"></p>

	<p><b>Chapter Title (optional):&nbsp; </b>
	<input type="text" name="ILLBookChapter" size="100"></p>

	<p><b>Chapter Pages (optional):&nbsp; </b>
	<input type="text" name="ILLBookChapterPages" size="25"></p>

	<p><b>Publisher:&nbsp; </b>
	<input type="text" name="ILLBookPublisher" size="100"></p>

	<p><b>Year of Publication (YYYY):&nbsp; </b>
	<input type="text" name="ILLBookPubYear" size="10">

	&nbsp;&nbsp;&nbsp;&nbsp;<b>Edition:&nbsp; </b>
	<input type="text" name="ILLBookEd" size="15"></p>
	
	<p><b>Not Needed After:&nbsp; </b>
	<input type="text" name="ILLNotNeeded" size="100"></p>
	
	<p><b>Additional Info:&nbsp; </b>
	<input type="text" name="ILLInfo" size="100"></p>
	

<!---------------------------------------- Copyright ---------------------------------------->

<hr>
<div class="style1">
	<strong>Warning Concerning Copyright Restrictions </strong>
</div>

<p>
The copyright law of the United States (Title 17, United States Code) governs the 
making of photocopies or other reproductions of copyright material. Under certain 
conditions specified in the law, libraries and archives are authorized to furnish 
a photocopy or other reproduction. One of these specified conditions is that the 
photocopy or reproduction is not to be "for any purpose other than private study, 
scholarship, or research". If a user makes a request for, or later uses, a 
photocopy or reproduction for purposes in excess of "fair use", that user may be 
liable for copyright infringement. This institution reserves the right to refuse 
a copying order if, in its judgment, fulfillment of the order would involve 
violation of copyright law.

</div>



<!------------------------------------------------------------------------------------------->
<!--------------------------- JOURNAL ARTICLE REQUEST --------------------------------------->
<!--------------- IF JOURNAL ARTICLE IS SELECTED, FOLLOWING DATA IS COLLECTED --------------->
<div class="chooseJournal">
<hr>
	<p><b>Journal Title:&nbsp; </b>
	<input type="text" name="ILLJournalTitle" size="100"></p>
  
	<p><b>ISSN:&nbsp; </b>
	<input type="text" name="ILLJournalISSN" size="20"></p>
  
	<p><b>Volume:&nbsp; </b>
	<input type="text" name="ILLJournalVolume" size="15">
  
	&nbsp;&nbsp;&nbsp;&nbsp;<b>Issue:&nbsp; </b>
	<input type="text" name="ILLJournalIssue" size="15">
  
	&nbsp;&nbsp;&nbsp;&nbsp;<b>Publication Date:&nbsp; </b>
	<input type="text" name="ILLJournalPubDate" size="20"></p>
  
	<p><b>PMID/PubMed Identifier:&nbsp; </b>
	<input type="text" name="ILLJournalPMID" size="25"></p>
  
	<p><b>ArticleTitle:&nbsp; </b>
	<input type="text" name="ILLJournalArticle" size="100"></p>

	<p>&nbsp;&nbsp;&nbsp;&nbsp;<b>Author:&nbsp; </b>
	<input type="text" name="ILLJournalArticleAuthor" size="100"></p>
  
	<p>&nbsp;&nbsp;&nbsp;&nbsp;<b>Page Range:&nbsp; </b>
	<input type="text" name="ILLJournalPages" size="20"></p>
	
	<p><b>Not Needed After:&nbsp; </b>
	<input type="text" name="ILLNotNeeded" size="100"></p>
 
	<p><b>Additional Info:&nbsp; </b>
	<input type="text" name="ILLInfo" size="100"></p>
	




<!---------------------------------------- Copyright ---------------------------------------->

<hr>
<div class="style1">
	<strong>Warning Concerning Copyright Restrictions </strong>
</div>

<p>
The copyright law of the United States (Title 17, United States Code) governs the 
making of photocopies or other reproductions of copyright material. Under certain 
conditions specified in the law, libraries and archives are authorized to furnish 
a photocopy or other reproduction. One of these specified conditions is that the 
photocopy or reproduction is not to be "for any purpose other than private study, 
scholarship, or research". If a user makes a request for, or later uses, a 
photocopy or reproduction for purposes in excess of "fair use", that user may be 
liable for copyright infringement. This institution reserves the right to refuse 
a copying order if, in its judgment, fulfillment of the order would involve 
violation of copyright law.

</div>



<!-------------------------------------------------------------------------------------->
<!------------------------------------ AV REQUEST -----==------------------------------->
<!------------ IF AUDIOVISUAL IS SELECTED, FOLLOWING DATA IS COLLECTED ----------------->
<div class="chooseAudiovisual">
<hr>
	<p><b>Audiovisual Title:&nbsp; </b>
	<input type="text" name="ILLAVTitle" size="100"></p>
  
	<p><b>Audiovisual Producer:&nbsp; </b>
	<input type="text" name="ILLAVProducer" size="100"></p>

	<p><b>Production Year:&nbsp; </b>
	<input type="text" name="ILLAVProductionYear" size="100"></p>

	<p><b>Not Needed After:&nbsp; </b>
	<input type="text" name="ILLNotNeeded" size="100"></p>

	<p><b>Additional Info:&nbsp; </b>
	<input type="text" name="ILLInfo" size="100"></p>
	

	
<!---------------------------------------- Copyright ---------------------------------------->

<hr>
<div class="style1">
	<strong>Warning Concerning Copyright Restrictions </strong>
</div>

<p>
The copyright law of the United States (Title 17, United States Code) governs the 
making of photocopies or other reproductions of copyright material. Under certain 
conditions specified in the law, libraries and archives are authorized to furnish 
a photocopy or other reproduction. One of these specified conditions is that the 
photocopy or reproduction is not to be "for any purpose other than private study, 
scholarship, or research". If a user makes a request for, or later uses, a 
photocopy or reproduction for purposes in excess of "fair use", that user may be 
liable for copyright infringement. This institution reserves the right to refuse 
a copying order if, in its judgment, fulfillment of the order would involve 
violation of copyright law.

</div>





<!------------------------------------ TIME TO SUBMIT ------------------------------------>

<hr>
<input type="hidden" name="ILLSubmitDate" value="<%=Date()%>">
<input type="hidden" name="ChartID" value="<%=session("ChartID")%>">
<input id="btnSubmit" type="submit" value="Submit Request">
<input id="btnClear" type="reset" value="Clear">

Open in new window


Following is the code displaying the results on the submit page:
txtBody = "Requestor's Name: " & request.form("ILLRequestorsFName") & " " & request.form("ILLRequestorsLName")
txtBody = txtBody & "<br>Service: " & request.form("ILLRequestorsService")
txtBody = txtBody & "<br>Email: " & request.form("ILLRequestorsEmail")
txtBody = txtBody & "<br>Phone: " & request.form("ILLRequestorsPhone")

	txtBody = txtBody & "<p>&nbsp;&nbsp;Type of Request: " & request.form("ILLRequestType")

	IF request.form("ILLRequestType") = "Book" THEN
		txtBody = txtBody & "<p>&nbsp;&nbsp;Book Author: " & request.form("ILLBookAuthor")
		txtBody = txtBody & "<br>&nbsp;&nbsp;Book Title: " & request.form("ILLBookTitle")
		txtBody = txtBody & "<br>&nbsp;&nbsp;ISBN: " & request.form("ILLBookISBN")
		txtBody = txtBody & "<br>&nbsp;&nbsp;Book Chapter: " & request.form("ILLBookChapter")
		txtBody = txtBody & "<br>&nbsp;&nbsp;Book Chapter Pages: " & request.form("ILLBookChapterPages")
		txtBody = txtBody & "<br>&nbsp;&nbsp;Publisher: " & request.form("ILLBookPublisher")
		txtBody = txtBody & "<br>&nbsp;&nbsp;Publication Date: " & request.form("ILLBookPubYear")
		txtBody = txtBody & "<br>&nbsp;&nbsp;Edition: " & request.form("ILLBookEd")
	END IF
	
	IF request.form("ILLRequestType") = "Audiovisual" THEN
		txtBody = txtBody & "<p>&nbsp;&nbsp;Audiovisual Title: " & request.form("ILLAVTitle")
		txtBody = txtBody & "<br>&nbsp;&nbsp;Producer: " & request.form("ILLAVProducer")
		txtBody = txtBody & "<br>&nbsp;&nbsp;Production Year: " & request.form("ILLAVProductionYear")
	END IF
	
	IF request.form("ILLRequestType") = "Journal Article" THEN
		txtBody = txtBody & "<p>&nbsp;&nbsp;Journal Title: " & request.form("ILLJournalTitle")
		txtBody = txtBody & "<br>&nbsp;&nbsp;ISSN: " & request.form("ILLJournalISSN")
		txtBody = txtBody & "<br>&nbsp;&nbsp;Volume: " & request.form("ILLJournalVolume")
		txtBody = txtBody & "&nbsp;&nbsp;Issue: " & request.form("ILLJournalIssue") 
		txtBody = txtBody & "&nbsp;&nbsp;Publication Date: " & request.form("ILLJournalPubDate") 
		txtBody = txtBody & "<br>&nbsp;&nbsp;PMID: " & request.form("ILLJournalPMID")
		txtBody = txtBody & "<br>&nbsp;&nbsp;Journal Article: " & request.form("ILLJournalArticle")
		txtBody = txtBody & "<br>&nbsp;&nbsp;Author: " & request.form("ILLJournalArticleAuthor")
		txtBody = txtBody & "<br>&nbsp;&nbsp;Page range: " & request.form("ILLJournalPages")
	END IF

		txtBody = txtBody & "<br>&nbsp;&nbsp;Not needed after: " & request.form("ILLNotNeeded")
		txtBody = txtBody & "<br>&nbsp;&nbsp;Additional Info: " & request.form("ILLInfo")

Open in new window


Screen display is also included and as you will see the two fields (ILLNotNeeded and ILLInfo) have two commas which are not needed. How can I eliminate them?
Display.png
0
Comment
Question by:Malloy1446
2 Comments
 
LVL 24

Accepted Solution

by:
mankowitz earned 500 total points
ID: 40542529
The problem is that you have three separate input fields which have the name ILLInfo, which are being concatenated by request.form("ILLInfo"). You should rename those fields so that they have different names

<!--------------------------- JOURNAL ARTICLE REQUEST --------------------------------------->
	<p><b>Additional Info:&nbsp; </b>
	<input type="text" name="ILLInfoJournalArticle" size="100"></p>

Open in new window


 and then in your display page, you could have something like this:

IF request.form("ILLRequestType") = "Journal Article" THEN
     txtBody = txtBody & "<br>&nbsp;&nbsp;Additional Info: " & request.form("ILLInfoJournalArticle")

Open in new window

0
 

Author Comment

by:Malloy1446
ID: 40542640
I knew that would be one solution, I just was hoping I would not need to create 4 additional fields.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

803 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