Question
I am having issues completing this excercise. Here is the exercise, and my code will be below it. Part 2, More databases to forms: The
I am having issues completing this excercise.
Here is the exercise, and my code will be below it.
Part 2, More databases to forms: The database weblab has a table of tools named tool_t. The table was created as follows:
CREATE TABLE tool_t ( tool_item_no char(10) PRIMARY KEY, tool_name char(20), tool_price numeric(6, 2), tool_weight numeric(4, 1), tool_picture char(30), tool_description varchar);
Change your order form to construct the item names, prices and weights by extracting the items from the database rather than hard-coding them. Display every item from the database. Do not assume that there will be a given number of items.
In the database table definition above, numeric(6, 2) means the item has a total of six digits, of which two are to the right of the decimal point.
Your order form should display the following items for each tool:
Name
Price
Shipping Weight
Each idem of your form should have a box to allow the customer to enter quantity as you did in earlier assignments.
You will not need the tool_picture or tool_description attributes. Present the tool names in alphabetical order. The following is a suitable query for retrieving from the database:
select tool_item_no, tool_name, tool_price, tool_weight from tool_t order by tool_name;
------------------------------------------------------------------
Here is Code
--------------------------------------------------------------
function quantityValidation()
{
var chisels = document.forms["form1"]["chisels_qty"].value;
var planers = document.forms["form1"]["planers_qty"].value;
var pitchforks = document.forms["form1"]["pitchforks_qty"].value;
var validation = new RegExp('^[0-9]+$');
if(chisels.length>0)
{
if (!chisels.match(validation))
{
document.getElementById('nmbError').innerText = "Enter Valid quantity of chisels ";
return false;
}
}
if(planers.length>0)
{
if (!planers.match(validation))
{
document.getElementById('nmbError').innerText = "Enter Valid quantity of planers ";
return false;
}
}
if(pitchforks.length>0)
{
if (!pitchforks.match(validation))
{
document.getElementById('nmbError').innerText = "Enter Valid quantity for of pitchforks ";
return false;
}
}
Tools Order
Tool Name | Price per Unit |
---|---|
Chisel | $5.00 |
Planer | $10.00 |
Pitchfork | $15.00 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started