Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #16398 > unrolled thread
| Started by | doctor@doctor.nl2k.ab.ca (The Doctor) |
|---|---|
| First post | 2012-10-04 21:16 +0000 |
| Last post | 2012-10-08 20:52 +0000 |
| Articles | 7 — 5 participants |
Back to article view | Back to comp.lang.javascript
Extracting data from a form doctor@doctor.nl2k.ab.ca (The Doctor) - 2012-10-04 21:16 +0000
Re: Extracting data from a form Danny <dann90038@gmail.com> - 2012-10-04 15:31 -0700
Re: Extracting data from a form JJ <jaejunks_at@_googlemail_dot._com> - 2012-10-05 01:34 +0000
Re: Extracting data from a form Dr J R Stockton <reply1240@merlyn.demon.co.uk.invalid> - 2012-10-06 19:12 +0100
Re: Extracting data from a form "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-10-07 07:34 +0000
Re: Extracting data from a form doctor@doctor.nl2k.ab.ca (The Doctor) - 2012-10-08 20:22 +0000
Re: Extracting data from a form "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-10-08 20:52 +0000
| From | doctor@doctor.nl2k.ab.ca (The Doctor) |
|---|---|
| Date | 2012-10-04 21:16 +0000 |
| Subject | Extracting data from a form |
| Message-ID | <k4kuc5$pnp$1@gallifrey.nk.ca> |
We are working with
<html><head>
<title>PDSolutions Course Order Form</title>
<link rel="stylesheet" type="text/css" href="franklin1style.css">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function load()
{
window.status = " "
}
function count()
{
var price277 = 63.00;
var price278 = 63.00;
// kortti
if (calc.price277.checked){
var wprice277 = document.calc.price277.value = price277;
} else {
var wprice277 = document.calc.price277.value = 0;
}
if (calc.price278.checked){
var wprice278 = document.calc.price278.value = price278;
} else {
var wprice278 = document.calc.price278.value = 0;
}
document.calc.charge_total.value = (wprice277 + wprice278 ) + ".00";
return charge_total;
}
</script>
<style type="text/css">
<!--
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 16px;
color: #003300;
}
.style2 {
color: #FF0000;
font-weight: bold;
}
.style3 {font-family: Arial, Helvetica, sans-serif}
.style5 {color: #0000CC; font-weight: bold; }
.style6 {color: #0000CC}
.style8 {color: #FFFFFF; font-weight: bold; }
-->
</style>
</head><body>
<div align="center">
<form action="https://www3.pass-to-bank/HPPDP/index.php" method="post" name="calc" onSubmit="return count();">
<input name="ps_store_id" value="NOYOUDONT" type="hidden">
<input name="hpp_key" value="YARIGHT" type="hidden">
<input name="rvar_subject" value=" Order Form" type="hidden">
<input name="rvar_recipients" value="die@spammer.com" type="hidden">
<input name="rvar_required" value="internal" type="hidden">
<input name="rvar_title" value=" Solutions Order" type="hidden">
<input name="rvar_cc_visitor" value="1" type="hidden">
<input name="rvar_bad_url" value="https://localpage/" type="hidden">
<input name="rvar_env_report" value="REMOTE_HOST,REMOTE_ADDR" type="hidden">
<input name="rvar_redirect" value="https://localpage/" type="hidden">
<table border="0" cellpadding="0" cellspacing="0" height="100" width="63%">
<tbody>
<tr>
<td colspan="2" height="594"><font color="navy" face="Verdana,Helvetica" size="4"><strong></strong></font>
<center>
<p><span class="style1"><font color="navy" face="Verdana,Helvetica" size="4"><strong>Solutions - OnLine Order
Form</strong></font></span><font color="navy" face="Verdana,Helvetica" size="4"><strong><font color="red" face="Verdana,Helvetica" size="3"><br>
</font></strong></font></p>
</center>
<div align="left"><font color="navy" face="Verdana,Helvetica" size="4"><strong><font face="Arial,Helvetica" size="-1"> <b>Online
Orders</b> - Complete and submit this form<br>
<b>Phone Orders</b> - Call <b>1-877-666-6666</b><br>
<b>Fax Orders</b> - Print the Order Form and FAX to <b>1-780-666-6666</b><br>
<b>Mail Orders</b> - Print the Order Form and mail to: <b>
Solutions Address</b></font></strong></font></div>
<p> </p>
<hr nosize="" 4="" align="center" width="11%">
<p class="style3"><font color="navy" face="Verdana,Helvetica" size="4"><strong><font face="Verdana,Helvetica" size="3"><span class="style2"> </span></font> </strong>
<table align="center" border="0" width="688">
<tbody>
<tr>
<td width="682">
<p class="style3" align="center"><font face="Verdana,Helvetica" size="3"><span class="style8">This page uses
javascript. Please turn javascript on the browser. </span></font> <font color="navy"> </font></p>
<p><span class="style3"><font color="navy"><strong> Note:</strong></font></span>
<font color="navy"> <font face="Arial,Helvetica" size="2">
</font></font></p><ol><font color="navy"><font face="Arial,Helvetica" size="2">
<li> All prices in CANADIAN Funds.</li>
<li> Canadian Residents 5% GST applies and will be
added to your order</li>
<li> Each course cost $60.00 + $3.00 GST , <a href="https://localpage/indexnongst.html">click
here if you are exempt from GST (federal, provincial and municipal
government)</a></li>
<li>
<ol>
<li> Select the course you wish to take </li>
<li> place the number one (1) in the quantity box </li>
<li>then click the "Calculate" button at the bottom
of the page to give you a total. </li>
<li> if you have made an error click on the reset
button at the bottom of the page</li>
</ol>
</li>
</font></font></ol><font color="navy"><font face="Arial,Helvetica" size="2">
</font></font><p></p>
</td>
</tr>
</tbody>
</table>
</font></p>
<p class="style3"><font color="navy" face="Verdana,Helvetica" size="4"><strong> <br>
<br>
</strong></font></p>
</td>
</tr>
</tbody>
</table>
<table align="center" border="2" cellpadding="2" cellspacing="2" width="677">
<tbody>
<tr>
<td align="center" width="44"><span class="style3">Course ID</span></td>
<td align="center" width="41"><span class="style3">Select Course</span></td>
<td align="center" width="144"><span class="style3">Description</span></td>
<td align="center" width="144"><span class="style3">Select
Quantity</span></td>
<td align="center" width="258"><span class="style3">Course Date</span></td>
</tr>
<tr>
<td align="center"><input name="id277" id="id277" value="Course" size="10"></td>
<td align="center"><input name="price277" id="price277" value="63.00" size="7" type="checkbox"></td>
<td align="center"><input name="description277" id="description277" value="Acute and Chronic Toxicity" type="text"></td>
<td align="center"><input name="quantity277" value="0" size="4" type="text"></td>
<td align="center">
<div align="left"><span class="style3">Nov 19 -2012 10:00
a.m.</span></div>
</td>
</tr>
<tr>
<td align="center"><input name="id278" id="id278" value="Course" size="10"></td>
<td align="center"><input name="price278" id="price278" value="63.00" size="7" type="checkbox"></td>
<td align="center"><input name="description278" id="description278" value="IPM Fundamentals" type="text"></td>
<td align="center"><input name="quantity278" value="0" size="4" type="text"></td>
<td align="center">
<div align="left"><span class="style3">Nov 19 -2012 12:00
noon</span></div>
</td>
</tr>
SNIP verbage
</td>
</tr-->
</tbody>
</table>
<br>
<span class="style8"> <font face="Arial,Helvetica" size="3">Please
note: Checkmark Select
Course and also the Corresponding Select Quantity is entered as 1, or
as many as required. </font></span> <br>
<br>
<center><span class="normalText style3">Price $ </span> <input name="charge_total" size="10" style="border: 1px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); font-family: tahoma; font-size: 8pt;" type="text"></center>
<center> <input onClick="count()" value="Calculate" style="border: 1px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); font-family: tahoma; font-size: 8pt;" type="button"> <input value="Reset" style="border: 1px solid rgb(0, 0, 0); background-color: rgb(255, 255, 255); color: rgb(0, 0, 0); font-family: tahoma; font-size: 8pt;" type="reset"> </center>
<center><br>
<br>
</center>
<br>
<br>
<table align="center" border="1" cellpadding="2" cellspacing="2" width="600">
<tbody>
<tr>
<td align="center"><span class="style3"><font color="black" face="Arial,Helvetica" size="3"> </font></span>
<div class="style3" align="left"><font color="black" face="Arial,Helvetica" size="3"><b>Student Personal Information</b></font></div>
</td>
</tr>
<tr>
<td align="right"><span class="style3"><font face="ARIAL" size="2"> </font></span><font face="ARIAL" size="2"> </font>
<div class="style3" align="left"><font face="ARIAL" size="2"><strong>First
Name
</strong> <input name="bill_first_name" size="54" maxlength="40" type="TEXT"> </font></div>
</td>
</tr>
<tr>
<td align="right"><span class="style3"><font face="ARIAL" size="2"> </font></span><font face="ARIAL" size="2"> </font>
<div class="style3" align="left"><font face="ARIAL" size="2"><strong>Last
Name
</strong> <input name="bill_last_name" size="54" maxlength="40" type="TEXT"> </font></div>
</td>
</tr>
<tr>
<td align="right"><span class="style3"><font face="ARIAL" size="2"> </font></span><font face="ARIAL" size="2"> </font>
<div class="style3" align="left"><font face="ARIAL" size="2"><strong>Address
</strong> <input name="bill_address_one" size="54" maxlength="54" type="TEXT"> </font></div>
</td>
</tr>
<tr>
<td align="right"><span class="style3"><font face="ARIAL" size="2"> </font></span><font face="ARIAL" size="2"> </font>
<div class="style3" align="left"><font face="ARIAL" size="2"><strong>Company
Name
if
Applicable
</strong> <input name="bill_company_name" size="54" maxlength="600" type="TEXT"> </font></div>
</td>
</tr>
<tr>
<td align="right"><span class="style3"><font face="ARIAL" size="2"> </font></span><font face="ARIAL" size="2"> </font>
<div class="style3" align="left"><font face="ARIAL" size="2"><strong>City
</strong> <input name="bill_city" size="28" maxlength="25" type="TEXT"> </font></div>
</td>
</tr>
<tr>
<td align="right"><span class="style3"><font> </font></span><font>
</font>
<div class="style3" align="left"><font><strong>State/Province </strong>
<input name="bill_state_or_province" size="12" maxlength="20" type="TEXT"> </font></div>
</td>
</tr>
<tr>
<td align="right"><span class="style3"><font face="ARIAL" size="2"> </font></span><font face="ARIAL" size="2"> </font>
<div class="style3" align="left"><font face="ARIAL" size="2"><strong>Country
</strong> <input name="bill_country" size="28" maxlength="40" value="Canada" type="TEXT"> </font></div>
</td>
</tr>
<tr>
<td align="right"><span class="style3"><font> </font></span><font>
</font>
<div class="style3" align="left"><font><strong>Postal Code </strong>
<input name="bill_postal_code" size="12" maxlength="25" type="TEXT"> </font></div>
</td>
</tr>
<tr>
<td align="right"><span class="style3"><font face="ARIAL" size="2"> </font></span><font face="ARIAL" size="2"> </font>
<div class="style3" align="left"><font face="ARIAL" size="2"><strong>Phone
</strong> <input name="bill_phone" size="12" maxlength="25" type="TEXT"> </font></div>
</td>
</tr>
<tr>
<td align="right"><span class="style3"> </span>
<div class="style3" align="left"><strong>Fax </strong> <input name="bill_fax" size="12" maxlength="25" type="TEXT"> </div>
</td>
</tr>
<tr>
<td align="right"><span class="style3"><font face="ARIAL" size="2"> </font></span><font face="ARIAL" size="2"> </font>
<div class="style3" align="left"><font face="ARIAL" size="2"><strong>Email
</strong> <input name="email" size="54" maxlength="60" type="TEXT"> <br>
<span class="style5">Please doublecheck your e-mail address as
it is used to send you a receipt.</span></font></div>
</td>
</tr>
<tr>
<td align="right"><span class="style3"><font face="ARIAL" size="2"> </font></span><font face="ARIAL" size="2"> </font>
<div class="style3" align="left"><font face="ARIAL" size="2"><strong>Date
Of
Birth
(MM/DD)
</strong> <input name="note" size="5" maxlength="5" type="TEXT">
<strong><br>
<span class="style6">Your applicator license is tracked by
using your birthday and name</span></strong> </font></div>
</td>
</tr>
</tbody>
</table>
<font color="green" face="Arial,Helvetica" size="3"> In order to
process your order fully, you need to complete the above
form completely.<br>
Do not leave any fields empty in the Student Personal Information
section. </font><font face="Arial,Helvetica" size="3"><br>
<br>
<font color="green"><strong>Proceed with your order.</strong></font></font>
<table border="0" cellpadding="0" cellspacing="0" width="26%">
<tbody>
<tr>
<td colspan="2"> </td>
</tr>
<tr align="center">
<td width="5%"><font color="black" face="Arial,Helvetica" size="4"> </font></td>
<td width="31%"><span class="style3"><font face="Arial,Helvetica" size="2"> Please check that all information has
been included and is accurate. Select
the 'Place Your Order' button.<br>
When you place your order you will receive a screen confirmation.<br>
Please fill in the credit card information and proceed with the
transaction</font></span><font face="Arial,Helvetica" size="2">. </font>
<p><font face="Arial,Helvetica" size="2"><font color="#2c5656"><font color="black">. </font></font></font></p>
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</tbody>
</table>
<font size="3"> <input value="Place Your Order" type="submit">
<input value="Clear the Form" type="reset"></font></form>
</div>
</body></html>
End HTML
All right we want to incorpration the Quantity Value
So the Total Price = Sum of Quantity (x) * Price (x) .
277 <= x <= 278 .
In this case.
How does one incorporate this into the total?
--
Member - Liberal International This is doctor@nl2k.ab.ca Ici doctor@nl2k.ab.ca
God,Queen and country!Never Satan President Republic!Beware AntiChrist rising!
http://www.fullyfollow.me/rootnl2k
USA petition to dissolve the Republic and vote to disoolve it in November 2012
[toc] | [next] | [standalone]
| From | Danny <dann90038@gmail.com> |
|---|---|
| Date | 2012-10-04 15:31 -0700 |
| Message-ID | <a8f9aa6b-92bd-4b84-b490-b583e9363386@googlegroups.com> |
| In reply to | #16398 |
Check -> http://www.javascriptkit.com/javatutors/form1.shtml Is a rather good resource for what you're seeking. BTW, not sure what app/utility/IDE gave you that source, but that markup is horrendous is very deprecated by about a decade. You may want to consider a better IDE/app/utility or a good book and an aide who knows webdev. :) PS: interesting(disturbing) footer in your posting ID :s
[toc] | [prev] | [next] | [standalone]
| From | JJ <jaejunks_at@_googlemail_dot._com> |
|---|---|
| Date | 2012-10-05 01:34 +0000 |
| Message-ID | <XnsA0E357D11D116jaejunksgooglemailco@0.0.0.44> |
| In reply to | #16398 |
doctor@doctor.nl2k.ab.ca (The Doctor) wrote:
> We are working with
>
> <html><head>
[snip]
> End HTML
>
> All right we want to incorpration the Quantity Value
>
> So the Total Price = Sum of Quantity (x) * Price (x) .
>
>
> 277 <= x <= 278 .
>
> In this case.
>
> How does one incorporate this into the total?
Use below "count" function replacement. The input quantity value in the
form must be a valid number greater than zero. Otherwise, if it's
negative or invalid number, it will be assumed as zero. The "price277",
"price278" form fields value must be a valid number for the course price,
or the code won't work.
You might want to learn the code instead of copy-paste-forget. Feel free
to ask if you don't understand something.
//courseNumber must be a number or a string of number.
//e.g.: 277, "278", etc.
function getTotalCoursePrice(courseNumber) {
if (calc['price'+courseNumber].checked){
var price = parseInt(calc['price'+courseNumber].value.trim());
var qty = parseInt(calc['quantity'+courseNumber].value.trim());
if (isNaN(qty) || (qty < 0)) qty = 0;
} else {
var price = 0;
var qty = 0;
}
return price * qty;
}
function count() {
var i, result = 0;
//loop the count for course number 277 to 278 inclusive.
for (i = 277; i <= 278; i++) i += getTotalCoursePrice(i);
calc.charge_total.value = result.toFixed(2);
//don't submit if total price is zero
return result > 0;
}
[toc] | [prev] | [next] | [standalone]
| From | Dr J R Stockton <reply1240@merlyn.demon.co.uk.invalid> |
|---|---|
| Date | 2012-10-06 19:12 +0100 |
| Message-ID | <U7ztmPEYSHcQFwqm@invalid.uk.co.demon.merlyn.invalid> |
| In reply to | #16410 |
In comp.lang.javascript message <XnsA0E357D11D116jaejunksgooglemailco@0. 0.0.44>, Fri, 5 Oct 2012 01:34:07, JJ <jaejunks_at@_googlemail_dot._com> posted: > The input quantity value in the >form must be a valid number greater than zero. Otherwise, if it's >negative or invalid number, it will be assumed as zero. Very bad practice. It should reported as unbelievable. -- (c) John Stockton, nr London, UK. For Mail, see Home Page. Turnpike, WinXP. Web <http://www.merlyn.demon.co.uk/> - FAQ-type topics, acronyms, and links. Command-prompt MiniTrue is useful for viewing/searching/altering files. Free, DOS/Win/UNIX now 2.0.6; see <URL:http://www.merlyn.demon.co.uk/pc-links.htm>.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2012-10-07 07:34 +0000 |
| Message-ID | <XnsA0E561686DA74eejj99@194.109.133.133> |
| In reply to | #16437 |
Dr J R Stockton wrote on 06 okt 2012 in comp.lang.javascript: > In comp.lang.javascript message <XnsA0E357D11D116jaejunksgooglemailco@0. > 0.0.44>, Fri, 5 Oct 2012 01:34:07, JJ <jaejunks_at@_googlemail_dot._com> > posted: > >> The input quantity value in the >>form must be a valid number greater than zero. Otherwise, if it's >>negative or invalid number, it will be assumed as zero. > > Very bad practice. I don't think zo, IF ..... If this zero is used to generate an error response to the user, it is acceptable. I would even add not-a-number to the zero response. > It should reported as unbelievable. Believing without reasonable substatiation is bad practice. But why [and where?] report this, [even while unbelievable], it being common practice in this world? -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | doctor@doctor.nl2k.ab.ca (The Doctor) |
|---|---|
| Date | 2012-10-08 20:22 +0000 |
| Message-ID | <k4vclb$rdc$1@gallifrey.nk.ca> |
| In reply to | #16440 |
In article <XnsA0E561686DA74eejj99@194.109.133.133>, Evertjan. <exxjxw.hannivoort@inter.nl.net> wrote: >Dr J R Stockton wrote on 06 okt 2012 in comp.lang.javascript: > >> In comp.lang.javascript message <XnsA0E357D11D116jaejunksgooglemailco@0. >> 0.0.44>, Fri, 5 Oct 2012 01:34:07, JJ <jaejunks_at@_googlemail_dot._com> >> posted: >> >>> The input quantity value in the >>>form must be a valid number greater than zero. Otherwise, if it's >>>negative or invalid number, it will be assumed as zero. >> >> Very bad practice. > >I don't think zo, IF ..... > >If this zero is used to generate an error response to the user, >it is acceptable. > >I would even add not-a-number to the zero response. > >> It should reported as unbelievable. > >Believing without reasonable substatiation is bad practice. > >But why [and where?] report this, >[even while unbelievable], >it being common practice in this world? > >-- >Evertjan. >The Netherlands. >(Please change the x'es to dots in my emailaddress) Tried it, did not work. -- Member - Liberal International This is doctor@nl2k.ab.ca Ici doctor@nl2k.ab.ca God,Queen and country!Never Satan President Republic!Beware AntiChrist rising! http://www.fullyfollow.me/rootnl2k USA petition to dissolve the Republic and vote to disoolve it in November 2012
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2012-10-08 20:52 +0000 |
| Message-ID | <XnsA0E6E8AB6D6CDeejj99@194.109.133.133> |
| In reply to | #16487 |
The Doctor wrote on 08 okt 2012 in comp.lang.javascript: > Tried it, did not work. Did it get you fired? -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web