javascript load function to select radio forms [message #224740] |
Thu, 05 October 2006 08:40 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma:
|
General (3 Stars) |
|
|
I am trying to make a web based client for a small group of people to send files to a print room, and also have it send some information gathered by them filling in some forms. I have pretty much no experiance with javascript and have only made a shitty website before in HTML, so please forgive this attempt, I know it is far from inspiring.
Here is my problem...
I have created a java script function to load details into form when the client selects a particular drop down menu, but have only made it load the details into text type inputs. However I want to create a second load function (function loaddetails(2)) that will change the values of the radio inputs (at the moment it is just there totest that i could put two java scripts in one page and have them called separetely). But I do not know how to do it. Can someone take a look at how I made the first java function and advise me on how to create the second one please?
Also please note that I realise that the file input type at the end isn't going to work, and show really make it a separate form, but I have not wriiten the asp script yet to handle the upload so i just shoved it there for now.
Here is the code:
Code:
<html>
<head>
<title>Spencer's reprographic print submission tool</title>
<script type="text/javascript">
function LoadDetails()
{
if (document.ticket.select.selectedIndex == 0)
{
document.ticket.name.value = '';
document.ticket.extension.value = '';
document.ticket.department.value = '';
}
if (document.ticket.select.selectedIndex == 1)
{
document.ticket.name.value = 'Spencer Elliott';
document.ticket.extension.value = '56656';
document.ticket.department.value = 'Document Services';
document.ticket.email.value = 'censored for the net';
}
if (document.ticket.select.selectedIndex == 2)
{
document.ticket.name.value = 'Trevor Murphy';
document.ticket.extension.value = '56437';
document.ticket.department.value = 'Document Services';
document.ticket.email.value = 'censored for the net';
}
}
function LoadDetails2()
{
if (document.ticket.select2.selectedIndex == 0)
{
document.ticket.extension.value = '';
}
if (document.ticket.select2.selectedIndex == 1)
{
document.ticket.extension.value = 'test2 works';
}
}
</script>
</head>
<body BGCOLOR="#EFEBDE">
<center>
<table width="974" border="1" cellspacing="0" cellpadding="0">
<tr>
<td class="header"><img src="Submissiontoolbanner.jpg" width="974" height="100" alt="spencer's print submission tool banner" /></td>
</tr>
</table>
</center>
<table width="100%" border="1" bordercolor=#C3C0B8 cellspacing="0" cellpadding="0">
<br><br>
</table>
<br><br>
<FORM name="ticket" action="http://censored.com/spencer/tickets" method="post">
<table align=right width="280" border="0" bordercolor=#c3c0b8 cellspacing="0" cellpadding="0">
<b><u>Auto-Complete Feature</u></b><br>
<b>Select Name</b><br>
<select name="select" onChange="LoadDetails();">
<option selected>please select</option>
<option>Spencer Elliott</option>
<option>Trevor Murphy</option>
</select>
<br>
<b>Select Auto-Form fill option</b>
<select name="select2" onChange="LoadDetails2();">
<option selected>please select</option>
<option>Single Sided A4 colour without tabs and clear fronts/blue backs</option>
</table>
<P>
<table width="100%" border="1" bordercolor=#C3C0B8 cellspacing="0" cellpadding="0">
<b>Personal details:</b><br><br>
<LABEL for="name">name: </LABEL>
<INPUT type="text" id="name"><BR><br>
<LABEL for="extension">extension: </LABEL>
<INPUT type="text" id="extension"><BR><br>
<LABEL for="deptartment">department: </LABEL>
<INPUT type="text" id="department"><BR><br>
<LABEL for="costcentre">cost centre: </LABEL>
<INPUT type="text" id="costcentre"><BR><br>
<LABEL for="projectcode">project code: </LABEL>
<INPUT type="text" id="projectcode"><BR><br>
<LABEL for="email">email: </LABEL>
<INPUT type="text" id="email"><BR><br>
Collection Method:
<select name="collection method">
<option>Collect from printroom</option>
<option>send internal mail</option>
</select><br><br>
<b>recipient details:</b> (if the same as sender details then leave blank)<br><br>
<LABEL for="recipient name">recipient name: </LABEL>
<INPUT type="text" id="recipient name"><BR><br>
<LABEL for="recipient extension">recipient extension: </LABEL>
<INPUT type="text" id="recipient extension"><BR><br>
<LABEL for="recipient email">recipient email: </LABEL>
<INPUT type="text" id="recipient email"><BR><br>
<INPUT type="radio" name="email client" value="Send Me confirmation Emails Only"> Send Me confirmation Emails Only<BR>
<INPUT type="radio" name="email client" value="Send Confirmation Emails To Me And Recipient" CHECKED>Send Confirmation Emails To Me And Recipient<BR>
<INPUT type="radio" name="email client" value="DO NOT Send confirmation Emails">DO NOT Send confirmation Emails<BR>
<br>
</table>
<br><br><br>
<table width="100%" border="1" bordercolor=#C3C0B8 cellspacing="0" cellpadding="0">
<b>Printing Requirments:</b><br><br>
<LABEL for="copies">copies: </LABEL>
<INPUT type="text" id="copies"><BR><br>
color printing or black and white?
<select name="colourvrsblandwhite">
<option>colour printing</option>
<option>black&white printing</option>
</select><br><br>
Paper Size:
<select name="paper size">
<option>A4</option>
<option>A5</option>
<option>A3</option>
<option>A6</option>
<option>other (specified in instructions)</option>
</select><br><br>
Single Sided or Double Sided?
<input type="radio" name="ssordbl" value="ss"CHECKED>Single Sided
<input type="radio" name="ssordbl" value="dbl">Double Sided<br><br>
Orientation of file?
<input type="radio" name="portraitorlandscape" value="L"CHECKED>Landscape
<input type="radio" name="portraitorlandscape" value="P">Portrait<br><br>
Special Printing instructions:<br>
<textarea rows="7"cols="70" wrap="physical" name="printing instructions">
Enter special instructions for printing here:
</textarea>
<br><br>
</table>
<br><br><br>
<table width="100%" border="1" bordercolor=#C3C0B8 cellspacing="0" cellpadding="0">
<b>Finishing Requirments:</b><br><br>
Type of Binding:
<select name="bindingtype">
<option>Wire</option>
<option>stapled</option>
<option>Saddle Stitched (booklet)</option>
<option>2 hole punched</option>
<option>4 hole punched</option>
<option>velo</option>
<option>other (Specified in instructions)
</select><br><br>
Covers to be used:
<select name="covers">
<option>Clear Front & Blue Back</option>
<option>Deutsche Bank Covers</option>
<option>Folders</option>
<option>Laminated Covers Sent Especially For The Job</option>
<option>other (Specified in instructions)
</select><br><br>
Do You Require Dividers/Tabs?
<input type="radio" name="dividers" value="no"CHECKED>No
<input type="radio" name="dividers" value="yes">Yes<br><br>
Do You Require Laminating?
<input type="radio" name="laminating" value="no"CHECKED>No
<input type="radio" name="laminating" value="yes">Yes<br><br>
Binding Edge?
<input type="radio" name="binding edge" value="long"CHECKED>Long Edge
<input type="radio" name="binding edge" value="short">Short Edge<br><br>
Special Finishing instructions:<br>
<textarea rows="7"cols="70" wrap="physical" name="printing instructions">
Enter special instructions for finishing here:
</textarea>
<br>
<br>
</table>
<BR><br><BR>
<table width="100%" border="1" bordercolor=#C3C0B8 cellspacing="0" cellpadding="0">
<b>CD and DVD creation:</b>(please leave blank if none required)<br><br>
CD or DVD? (please note that CD's can hold 700mb of data, and DVD's can hold 4.7gb)
<input type="radio" name="cd" value="CD">CD
<input type="radio" name="cd" value="DVD">DVD<br><br>
</table>
<table width="100%" border="1" bordercolor=#C3C0B8 cellspacing="0" cellpadding="0">
<br><br><br>
<b>Browse to file you want printed here:</b><br><br>
<input type="hidden" name="MAX_FILE_SIZE" value="51200">
<input type="file" name="upload1"><br>
<br>
</table>
<br><br><br>
<INPUT type="submit" value="Submit request"> <INPUT type="reset" value="clear form">
</P>
</FORM>
|
|
|