Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

html/web form

Thread Tools
 
Search this Thread
 
Old 09 October 2003, 02:00 PM
  #1  
ChristianR
Scooby Regular
Thread Starter
iTrader: (1)
 
ChristianR's Avatar
 
Join Date: May 2001
Location: Europe
Posts: 6,329
Likes: 0
Received 1 Like on 1 Post
Post

Anyone know the source for the a form to calculate if a person selects relevant radius buttons/tick boxes?

i.e.I want people to tick a box if they want anon. If they do they are changed £5
and then that amount to add on to if they want a 3month £15, or 6month package at £10

I then want a total field which will show the total. i.e if someone ticked anon and 3month, the net amount of £20 is shown.

Old 10 October 2003, 09:44 AM
  #2  
ChristianR
Scooby Regular
Thread Starter
iTrader: (1)
 
ChristianR's Avatar
 
Join Date: May 2001
Location: Europe
Posts: 6,329
Likes: 0
Received 1 Like on 1 Post
Post

top
Old 10 October 2003, 10:28 AM
  #3  
SJ_Skyline
Scooby Senior
 
SJ_Skyline's Avatar
 
Join Date: Apr 2002
Location: Limbo
Posts: 21,922
Likes: 0
Received 1 Like on 1 Post
Wink

Cheap and nasty:



<html>
<head>
<script language="JavaScript">

function count()
{
var item1price = 5;
var item2price = 15;
var item3price = 10;

if (calc.item1.checked)
{
var witem1 = document.calc.item1.value = item1price;
}
else
{
var witem1 = document.calc.item1.value = 0;
}

if (calc.item2.checked)
{
var witem2 = document.calc.item2.value = item2price;
}
else
{
var witem2 = document.calc.item2.value = 0;
}

if (calc.item3.checked)
{
var witem3 = document.calc.item3.value = item3price;
}
else
{
var witem3 = document.calc.item3.value = 0;
}
document.calc.pay.value = witem1 + witem2 + witem3;
}
</script>
</head>

<body>

<center>
<form name="calc" method="POST" ID="Form1">
<table width="450" border="0" cellpadding="3" ID="Table1">
<tr>
<th bgcolor="#333333" width="50%" align="left"><span class="whiteText">Item</span></th>
<th bgcolor="#333333" width="50%" align="right"><span class="whiteText">Select</span></th>
</tr>
<tr>
<td bgcolor="#eeeeee"><span class="normalText">Item 1</span></td>
<td bgcolor="#eeeeee" align="right"><input type="checkbox" name="item1" size="10" ID="Checkbox1" onclick="count()"></td>
</tr>
<tr>
<td bgcolor="#eeeeee"><span class="normalText">Item 2</span></td>
<td bgcolor="#eeeeee" align="right"><input type="checkbox" name="item2" size="10" ID="Checkbox2" onclick="count()"></td>
</tr>
<tr>
<td bgcolor="#eeeeee"><span class="normalText">Item 3</span></td>
<td bgcolor="#eeeeee" align="right"><input type="checkbox" name="item3" size="10" ID="Checkbox3" onclick="count()"></td>
</tr>
<tr>
<td bgcolor="#cccccc" colspan="2" align="right"><span class="normalText">Price £</span><input type="text" name="pay" size="10" style="background-color:#ffffff; color:#000000; border:1px solid #000000; font-family:tahoma; font-size:8pt; letter-spacing=1px" ID="Text1"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
Old 10 October 2003, 01:35 PM
  #4  
ChristianR
Scooby Regular
Thread Starter
iTrader: (1)
 
ChristianR's Avatar
 
Join Date: May 2001
Location: Europe
Posts: 6,329
Likes: 0
Received 1 Like on 1 Post
Post

cheers.. however they can only select say the top 1, and then either 2 or 3. at the moment you can select all, which I do not want.
Old 10 October 2003, 01:48 PM
  #5  
chiark
Scooby Regular
 
chiark's Avatar
 
Join Date: Jun 2000
Posts: 13,735
Likes: 0
Received 0 Likes on 0 Posts
Post

well the basics are there mate- spend ten minutes with that and a javascript reference and you're there

Also bear in mind that you will have to perform the same checks server-side, otherwise people can and will frig with a customised client to submit the data.

[Edited by chiark - 10/10/2003 1:50:05 PM]
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Frizzle-Dee
Essex Subaru Owners Club
13
09 March 2019 07:35 PM
Frizzle-Dee
Essex Subaru Owners Club
13
01 December 2015 09:37 AM
Mattybr5@MB Developments
Full Cars Breaking For Spares
20
22 October 2015 06:12 AM
hawkeyescoob
ScoobyNet General
2
09 September 2015 12:03 PM



Quick Reply: html/web form



All times are GMT +1. The time now is 03:42 AM.