Hello everyone, i'm new here, i'm currently studying to become a web designer at my local college i've been given this assignment and i searched all over the net for solutions and no luck so I registered hear to ask for your knowledge and wisdom to assist me so that way I can understand it better. this is the assignment im working on, i'm listing the link to the pdf of my assignment.....and please to each solution list the task number for me too please. http://daora-d.com/pdf/Assignment.pdf
please to each solution list the task number for me too please.
seriously? How are you planning on filling in this section:
I CERTIFY THAT THIS ASSIGNMENT TASK IS MY OWN WORK & I HAVE REFERENCED ALL MATERIALS USED FROM ALL OTHER SOURCES.
?
How about you post what you have done so far and the problems that you are having? That way you might actually learn something and probably won't be accused of cheating.
seriously? How are you planning on filling in this section:
I CERTIFY THAT THIS ASSIGNMENT TASK IS MY OWN WORK & I HAVE REFERENCED ALL MATERIALS USED FROM ALL OTHER SOURCES.
?
How about you post what you have done so far and the problems that you are having? That way you might actually learn something and probably won't be accused of cheating.
I had a talk with the teacher and he said as long i comment on were I acquired the scripts from and have my own comments. so me asking for help on here will be no problem
<style>
body{
font-family:Verdana, Geneva, sans-serif;
font-size:12px;
}
fieldset{
width:512px;
}
table, td, th{
padding:0px;
margin:10px;
border:none;
}
#sub{
margin:0px;
}
th{
vertical-align:text-top;
text-align:right;
padding-right:10px;
font-weight:normal;
width:100px;
}
.alt{
background-color:#eee;
}
.errorBeans {
display:none;
}
.errorType {
display:none;
}
.errorName {
display:none;
}
.errorAddress {
display:none;
}
.errorCity {
display:none;
}
.errorState {
display:none;
}
.errorPost {
display:none;
}
</style>
<script type="text/javascript" language="javascript">
function validate(beanForm)
{
errorflag=0
}if document.getElementById(beans).value=true
return:false;}
}
</script>
</head>
<body>
<h2>Task 3 – 15 Marks</h2>
<p style="font-weight:bold; color:black;">Create a form as described below with any relevant validation for StarBuzz’s coffee ordering page. Use the Html provided.</p>
<form id="beanForm">
<fieldset><legend>The Starbuzz Bean Machine</legend>
<table>
<tr class="alt">
<th>Choose your beans:</th>
<td>
<select id="beans" name="beans">
<option value="House Blend">House Blend</option>
<option value="Bolivia">Shade Grown Bolivia Supremo</option>
<option value="Guatemala">Organitc Guatemala</option>
<option value="Kenya">Kenya</option>
</select><br />
<span class="errorBeans" style="color:red;">Please make a selection</span>
</td>
</tr>
<tr>
<th>Type:</th>
<td>
<label><input id="beantype" name="beantype" type="radio" value="whole" /> Whole Bean</label><br/>
<label><input id="beantype" name="beantype" type="radio" value="ground" /> Ground</label><br />
<span class="errorType" style="color:red;" >Which bean would you like?</span>
</td>
</tr>
<tr class="alt">
<th>Extras:</th>
<td>
<label><input id="extras[]" name="extras[]" type="checkbox" value="giftwrap" /> Gift Wrap</label><br/>
<label><input id="extras[]" name="extras[]" type="checkbox" value="catalog" /> Include a catalog</label>
</td>
</tr>
<tr>
<th>Ship to:</th>
<td>
<table id="sub">
<tr>
<td>Name:</td>
<td><input id="name" name="name" type="text" /><br />
<span class="errorName" style="color:red;">Please enter your name</span></td>
</tr>
<tr>
<td>Address:</td>
<td><input id="address" name="address" type="text" /><br />
<span class="errorAddress" style="color:red;">Your address is required</span></td> <!-- The error will come up if there was no input added in the address link -->
</tr>
<tr>
<td>City:</td>
<td><input id="city" name="city" type="text" /><br />
<span class="errorCity" style="color:red;">Please insert your city</span></td>
</tr>
<tr>
<td>State:</td>
<td><input name="state" type="text" id="state" size="8" maxlength="8" /><br />
<span class="errorState" style="color:red;">Please insert your state</span></td>
</tr>
<tr>
<td>Post Code:</td>
<td><input name="zip" type="text" id="zip" size="4" maxlength="4" /><br />
<span class="errorPost" style="color:red;">Incorrect values</span></td>
</tr>
</table>
</td>
</tr>
<tr class="alt">
<th>comments:</th>
<td>
<textarea id="comments" name="comments" cols="45" rows="10"></textarea>
</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="Submit" onClick =""/></td>
</tr>
</table>
</fieldset>
</form>
</body>
</html>
This is what i tried to achieve so far.....but im all out of ideas i know it involves if statements but i dont know how to construct it.......i gave the attribute names for each value example name=beans.
In your beans select list you must supply a starting option (or make one choice pre-selected so that whatever happens an option is selected).
Code:
<option value = "0" >Choose a type of bean... >
and then in script
Code:
var val = document.beanForm.beans.value;
which will return the selected value. If that value == 0 then the user has not made a selection - try again. Obviously if one option is pre-selected then there is no need to make a check, but you still need to capture the value of the selection.
But your very limited Javascript code offering suggests that you really have little knowledge of Javascript.
Be aware that <seript language = "Javascript"> has been obsolete since 1997.
__________________
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
What do you mean by this, Philip M? Do you mean the script tags themselves have become obsolete?
No, of course not. Don't be silly! Surely you know this! It has been mentioned in this forum a zillion times!
<script language=javascript> is long deprecated (since 1997). Use <script type = "text/javascript"> instead (in fact also deprecated but still necessary for IE<9). The <!-- and //--> comment (hiding) tags have also not been necessary since IE3 (i.e. since September 1997). If you see these in some published script it is a warning that you are looking at ancient and perhaps unreliable code.
__________________
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.