View Full Version : Form problem capturing referring URL content

09-26-2007, 06:19 PM
I have put together a form to pull information from a referring URL and put it into text boxes. When it pulls the info, it also pulls in all the "+" signs, etc. that separate each word in the URL. Is there anyway to alter it so that it will pull the words but not the extra symbols between words?


<head><title>Ill Form-Article Linker</title>
<script language="JavaScript">
function loadRefURL (){
document.forms[0].theAddr.value = document.referrer;

<script language="JavaScript">
// JavaScript Document

/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: wsabstract.com | http://www.wsabstract.com */
function checkrequired(which) {
var pass=true;
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,8)=="required") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.selectedIndex==0)) {
if (!pass) {
alert("The "+shortFieldName+" field is a required field.");
return false;
} else {
return true;
<meta name="keywords" content="">
<meta name="Generator" content="HTMLpad">

<style type="text/css">
.style1 {
font-size: 18px;
font-weight: bold;

<script type="text/javascript">
function getQueryValue(name) {
var match = (new RegExp('[?&;]' + name + '=([^&;#]*)')).exec(document.referrer);

return match ? unescape(match[1]) : null;

function populateFields() {
var controls = document.forms.form1.elements,
fieldMap = {ArticleTitle: 'atitle', JournalTitle: 'title', ISSN: 'issn', DatePub: 'date',
StartPage: 'spage', Volume: 'volume', Issue: 'issue',
AuthorLastName: 'aulast', AuthorFirstName: 'aufirst', ArticleAuthor: 'author', Authors: 'authors'};

for (var i = 0, n = controls.length; i < n; ++i) {
var value = getQueryValue(fieldMap[controls[i].name]);
if (value) controls[i].value = value;


<body onLoad="populateFields(); loadRefURL()">

<form method=post action=http://ezproxy.twu.edu:2065/cgi-bin/aspmail.asp id=form1 name=form1 onSubmit="return checkrequired(this)">

<input type=hidden name=sendername value="Automailer">
<input type=hidden name=subject value="Request for interlibrary loan (generated by Article Linker results page)">
<input type=hidden name=recipientname value="ILL">
<input type=hidden name=recipientmail value="ill@mail.twu.edu">
<input type=hidden name=redirect value=http://ezproxy.twu.edu:2065/library/>
<input type=hidden name=userinfo value="on">

<span class="style1">Interlibrary Loan request form--TWU Libraries</span>

<br />
<br />

<b>Patron Last Name, First Name: (required field)</b>
<input type="text" name="required Name" size="50" /><br><br>
<b>Student ID: (required field)</b>
<input type="text" name="required ID#SSN" size="50" /><br><br>
<b>Patron Address: (required field)</b> <br />

<textarea name="required Address:" rows="3" cols="20" wrap="virtual"></textarea><br><br>

<b>Patron Email Address (required field): </b>
<input type="text" name="required Email Address" size="50"/><br><br>

<b>Phone: </b>
<input type="text" name="Phone" size="50"/><br><br>

<b>Pickup Location: </b>
<select id="Department" name="Campus">
<option selected>Denton</option>

<option>Distance Education</option>
<br />
<br />
<b>Campus Status: </b>
<select id="Status" name="CampusStatus">
<option selected>Undergraduate</option>

<option>Distance Education</option>
</select><br /><br />
<b>Other Comments (optional): </b> <br />

<textarea name="Comments:" rows="3" cols="40" wrap="virtual"></textarea><br><br>

<strong>Please scroll down and submit the form. Do not edit any information below this point.</strong>

<br /><br />

<label>Journal Title:</label> <input name="JournalTitle" type="text" /><br /><br />
<label>ISSN:</label> <input name="ISSN" type="text" /><br /><br />
<label>Volume: </label><input name="Volume" type="text" /><br /><br />

<label>Issue: </label><input name="Issue" type="text" /><br /><br />
<label>Date: </label><input name="DatePub" type="text" /> <br /><br />

<label>Article Title: </label><input name="ArticleTitle" type="text" /><br /><br />
<label>Author: </label><input name="ArticleAuthor" type="text" /><br /><br />
<label>Author Last Name: </label><input name="AuthorLastName" type="text" /><br /><br />

<label>Author First Name: </label><input name="AuthorFirstName" type="text" /><br /><br />

<label>Authors: <input name="Authors" type="text" size="50" / ></label><br /><br />
<label>Start Page: <input name="StartPage" type="text" size="50" /></label></strong><br /><br />

<strong>Date Requested: </strong><input type="text" name="Requested" size=11>
<br /><br />
<strong>Page URL: </strong><input type=text name="theAddr" size=50 /><br /><br />
<input type="submit" value="submit">

</form> <script>

/*Current date in form credit:
JavaScript Kit (www.javascriptkit.com)
Over 200+ free scripts here!

var mydate=new Date()
var theyear=mydate.getYear()
if (theyear < 1000)
var theday=mydate.getDay()
var themonth=mydate.getMonth()+1
if (themonth<10)
var theday=mydate.getDate()
if (theday<10)

//////EDIT below three variable to customize the format of the date/////

var displayfirst=themonth
var displaysecond=theday
var displaythird=theyear





Reply With Quote