Thirusha 20 Posting Whiz

It should work if the form is posting correctly, can u post the code of both the pages, and I can take a look.

Thirusha 20 Posting Whiz

I see you are posting to a html page. request.getParameter will only work server side, that is not on a html page but rather on a jsp page.

Thirusha 20 Posting Whiz

It would work in the same way as above, that is place the response in an area on the page.

Remember to mark the thread solved once your question is answered so that other users dont reply to a thread that is in fact solved.

Thirusha 20 Posting Whiz

Ensure that those fields are within the form tags on the page you are submitting

Thirusha 20 Posting Whiz

I think you should change the button on the Actions.html page from a type submit to a type button, then add an onclick event, this way it will let u know if something is wrong, with a type submit, the page will always submit.

I played around with the code u provided, and i think u should change the following on the Actions.html page, add the function that u validate the input, and change the button to this:

<input type="button" value="submit" onclick="valtext(document.getElementById('username').value)" />

<script>
function valtext(val)
{
 if(val == "")
 {
  alert("Form is not filled");
  parent.FrameSet1.document.getElementById("ff").innerHTML = "Form is not filled";
  return false;
 }
 else
 {

  return true;

 }
}
</script>

I added a div tag to the FrameSet.html page.

You were on the right track, the reason for your function not working was that the function required a variable to be passed to it, which you didnt supply.

What helps alot when coding in javascript in Firefox's Firebug, try and get it.

Thirusha 20 Posting Whiz

in the ajax function, where you process the response, you will set the innerhtml of that frame to be the response.
something like this,

document.getElementById('frameId').innerHTML = req.responseText

You can post the code that u have so far, and i shall take a look.

Thirusha 20 Posting Whiz

Loads of people here wouldnt mind helping, but u have to state what the problem is.

Thirusha 20 Posting Whiz

Start with the basics, create a page with three frames.
Then go to http://www.w3schools.com/Ajax/ajax_example.asp, play around with the example.

You can use the same ajax code that is provided on that site, and incorporate it into the page with the three frames.

Thirusha 20 Posting Whiz

Have u been able to come up with anything?
Ajax isnt difficult. try w3schools' website.

deadmancoder commented: Thanks girl +1
Thirusha 20 Posting Whiz

Sorry, i thought u had an error, the thread wasnt marked solved.

Thirusha 20 Posting Whiz

Can u give an explanation of what the problem is?

I have tried this, and on the onmouseover event, the innerhtml is changed. I had removed the images and just places text since i dont have the images.

Thirusha 20 Posting Whiz

works for me in FF, i m using FF 3.5.2

it did give one warning, regarding the use of document.getElementById, so i changed the code to this and it still works but this time with no warning:

function typewriter(typein) {
document.getElementById('typeout').innerHTML = typein;
}

What error are u getting?
Have u tried firebug?

Thirusha 20 Posting Whiz

Go to http://dev.mysql.com/downloads/

The latest version of the community server (this is under the GPL licence) and it should work fine.
I dont remember having to put anything in the environment variables but there is documentation about how to install the server, its pretty simple though.

kvprajapati commented: ..you googled it for ishlux. +13
Thirusha 20 Posting Whiz

So i took the quiz located on the link that u provided in an earlier post, and i was able to be redirected to the correct page, no error, i had chosen all the first options, which took me to the laser cutting page.

Is a certain option giving u a problem?

Thirusha 20 Posting Whiz

I dont use MS Sql anymore, but as far as I can remember the data will NOT be automatically inserted. You have to insert the data.

There has to be data in the table which references the foreign key, so in your case the department table has to have valid data. Then when inserting records into the Employee table the correct department id must be used.

I suspect that u cannot insert records into the employee table as u dont have any records in the department table.

Thirusha 20 Posting Whiz

As u have stated that some proposals dont have a bid, you cant group by a null value.

Thirusha 20 Posting Whiz

some code will be really useful.
I am guessing that in the class your are most likely sending the entire file.

Thirusha 20 Posting Whiz

You will not see the options in the dropdown cause u have not written the "<option>" tag anywhere.

So in the loop where u loop thru the elements, u will have to use the createElement in javascript which looks like this:

var ele = document.getElementById("lstAgencyCity");
           var newOption=document.createElement("OPTION");
           newOption.value=selArray[i][0];
           newOption.text=selArray[i][1];
           ele.options.add(newOption);
Thirusha 20 Posting Whiz

I think u should provide some code, then we can help when u get stuck.

Thirusha 20 Posting Whiz

On the top file navigation, go to Window --> then click Palette

The palette will only show the drag and drop stuff when a jsp page is open.

Thirusha 20 Posting Whiz

Can you provide some code, it will be much easier for someone to help you.

Thirusha 20 Posting Whiz

Please use the code that I inserted above in the thread, u have removed extra stuff from the code, which has resulted in the javascript function not being complete.

Try and use the firefox browser with the firebug add-on, this helps greatly when working with javascript, it will tell u exactly what the error is.

Thirusha 20 Posting Whiz

Pleasure

Thirusha 20 Posting Whiz

w3schools is pretty good.

http://www.w3schools.com/JS/default.asp

laura_ci commented: Thank you for the help +1
Thirusha 20 Posting Whiz

Please use the code tags when inserting code, just makes it look neater.

Also i see you have removed some stuff in the javascript code, use this code:

<p><span style="font-size: small;">Your project needs to get started, but where do you start? Should you use waterjet or laser cutting? What if your material is thick? Take the quiz below and find out what cutting method is best for completing your project!</span></p>
<p><span style="font-size: small;">The Cutting Method Assessment is the perfect tool to help you decide which path to take&nbsp;when you&nbsp;start manufacturing your parts.</span></p>
<!-- begin quiz script -->
<script type="text/javascript"><!--
function finish() {
var ext = '.html';
var results = new Array("none","waterjet-cutting","laser-cutting","water-only","Machining or Value-Added","You're Out of Luck");
var nums = new Array(6);
for(var i = 0; i < nums.length; i++) nums[i] = 0;
for(var i = 1; i <= 7; i++) {
var q = document.forms['quiz'].elements['question_'+i];
if(q[0].type=='checkbox') {
var n = 0;
}
for(var j = 0; j < q.length; j++) {
if(q[j].checked) {
var a = q[j].value.split(',');
for(var k = 0; k < a.length; k++) {
nums[a[k]]++;
}
if(q[j].type=='radio') break;
else n++;
}
if(j == q.length-1&&q[j].type=='radio') {nums[0]++;}
}
if(q[0].type=='checkbox'&&((document.forms['quiz'].elements['question_'+i+'_min']&&n<document.forms['quiz'].elements['question_'+i+'_min'].value)||(document.forms['quiz'].elements['question_'+i+'_max']&&n>document.forms['quiz'].elements['question_'+i+'_max'].value))) nums[0]++;
}
var j = new Array('0');
for (i in nums) if(nums[i]>nums[j[0]]){j=new Array(''+i);} else if(nums[i]==nums[j[0]])j[j.length] = i;
//var o = '';for(var i in results)o+=results[i]+'='+nums[i]+'\n';
//alert(o);
if(nums[0]!=0) {
alert('You missed or incorrectly answered '+nums[0]+' questions!');
}
else if(j[0]==0) {
alert('No result could be determined.');
}
else {
location = results[j[0]];
}
}
// --></script>
<!-- end quiz script --><!-- begin …
Thirusha 20 Posting Whiz

404 normally means that a page doesnt exist.
i think if u remove this part of the code then it should work:
towards the end of the javascript code locate this line:

location = results[j[0]]+ext;

replace that line with this one:

location = results[j[0]];

also ensure that the names in the array are the same as where u want them to go for example i can see in the code that you have to change the name in the array(var results), where u see "Waterjet Cutting" to "waterjet-cutting"

Thirusha 20 Posting Whiz

You just replace the form tag that u have.
Here is the entire code i used, i have only tested it in firefox

<p><span style="font-size: small;">Your project needs to get started, but where do you start? Should you use waterjet or laser cutting? What if your material is thick? Take the quiz below and find out what cutting method is best for completing your project!</span></p>
<p><span style="font-size: small;">The Cutting Method Assessment is the perfect tool to help you decide which path to take&nbsp;when you&nbsp;start manufacturing your parts.</span></p>
<!-- begin quiz script -->
<script type="text/javascript"><!--
function finish() {
var ext = '.html';
var results = new Array("none","Waterjet Cutting","Laser Cutting","Water-Only Cutting","Machining or Value-Added","You're Out of Luck");
var nums = new Array(6);
for(var i = 0; i < nums.length; i++) nums[i] = 0;
for(var i = 1; i <= 7; i++) {
var q = document.forms['quiz'].elements['question_'+i];
if(q[0].type=='checkbox') {
var n = 0;
}
for(var j = 0; j < q.length; j++) {
if(q[j].checked) {
var a = q[j].value.split(',');
for(var k = 0; k < a.length; k++) {
nums[a[k]]++;
}
if(q[j].type=='radio') break;
else n++;
}
if(j == q.length-1&&q[j].type=='radio') {nums[0]++;}
}
if(q[0].type=='checkbox'&&((document.forms['quiz'].elements['question_'+i+'_min']&&n<document.forms['quiz'].elements['question_'+i+'_min'].value)||(document.forms['quiz'].elements['question_'+i+'_max']&&n>document.forms['quiz'].elements['question_'+i+'_max'].value))) nums[0]++;
}
var j = new Array('0');
for (i in nums) if(nums[i]>nums[j[0]]){j=new Array(''+i);} else if(nums[i]==nums[j[0]])j[j.length] = i;
//var o = '';for(var i in results)o+=results[i]+'='+nums[i]+'\n';
//alert(o);
if(nums[0]!=0) {
alert('You missed or incorrectly answered '+nums[0]+' questions!');
}
else if(j[0]==0) {
alert('No result could be determined.');
}
else {
location = results[j[0]]+ext;
}
}
// --></script>
<!-- end quiz script --><!-- begin quiz html …
Thirusha 20 Posting Whiz

You need to put the name of the form so change the form tag to include name="quiz" like this:

<form name="quiz" action="javascript:finish();" enctype="application/x-www-form-urlencoded" method="get">
Thirusha 20 Posting Whiz

I could be wrong but i dont think there is one, as far as I know, when u use

navigator.appName

, the result in Mozilla will be Netscape.

So if the code checks for Netscape it would work in Firefox

Thirusha 20 Posting Whiz

nope, but will keep working on it.

why dont u rather implement a function on the onlick event.
I personally dont like using the onblur event.

Thirusha 20 Posting Whiz

In javascript 'If' cannot be capital, if u change the 'If' in your function to small letters 'if', it would work.

Thirusha 20 Posting Whiz

You could try putting the include in a div tag, then in your if statement, set the innerhtml of the div to the correct include,

I havent tested this, so i could be wrong.

Thirusha 20 Posting Whiz

Your session attribute for value will be 4 since only one value is stored in an attribute, in the loop you are overwriting teh value, by the next number in the loop.

To get teh value of the link clicked, u can pass the value in the url so the url could look somehting like this:

<a href="ProductController?selectedValue=link&selLink="<%=obj%>>

then use request.getParameter to get the value of selLink

Thirusha 20 Posting Whiz

requesting from a servlet should still work, i just used a jsp, is the code the same though?

another thing, when u browse directly to the servlet using the url you are using in the ajax call, does the servelt return a result?

Thirusha 20 Posting Whiz

Can u post the code u are using, i edited the one here to this and it works in FF:

function   validateUser() {

    if(window.XMLHttpRequest){
       req=new XMLHttpRequest();
    } else if (window.ActiveXObject) {
    req=new ActiveXObject("Microsoft.XMLHTTP");
    }
    else{
    alert("Your browser does not support XMLHTTP!");
    }
       //var  idField=document.getElementById("userid");
       var url="serviceinput.jsp" ;
       url+="?userid=5";
	   req.open("GET",url,true);
	   req.onreadystatechange = function() {
	           if (req.readyState == 4) {
document.getElementById('userIdMessage').innerHTML = req.responseText;
	           }
	   }
req.send(null);
   }

I had to change the url, and comment some of the existing code, since i dont have the fields.

Thirusha 20 Posting Whiz

Is there any reason that u would need the hyperlink inside a database?

You could always just read the values from the database and then code in the links in whatever language u are using

Thirusha 20 Posting Whiz

I dont know php, but have u have u tried writing out the sql statement. To me it seems as though the statement is looking for "$suburb", i think u have forgotten to put the curly brackets around $suburb, i say this cause i see to get teh value of the table u used the curly brackets, shouldnt the same be done to get the value for the variable $suburb?

Thirusha 20 Posting Whiz

If the length is always the same amount than u can use the substring function, there are two of them:
SUBSTRING(str,pos)
SUBSTRING(str,pos,len)

Thirusha 20 Posting Whiz

I think u should rather do a search on the internet for a regular expression that will validate the email field, much less coding is needed.

Thirusha 20 Posting Whiz

First you have to disable the submit button then on each checkboxes onclick event do a check to see if all of them are checked, then enable the button again.

code will look something like this:

function check(){
if (document.getElementById('chkId1').checked==true && document.getElementById('chkId2').checked==true && document.getElementById('chkId3').checked==true){
document.getElementById(button).disabled = ' ';
}
}
Thirusha 20 Posting Whiz

What you could do, is on the submit function of your button, check which radio button was selected, then change the value of the form action attribute.
for the changing of the value of the form action:

document.formName.action ="whever u want it to go"

formName is the name of your form.

Thirusha 20 Posting Whiz

Why not use session attrbiutes, that way the variables will be available for the entire session.

Thirusha 20 Posting Whiz

There is a class called BufferedReader which you can use. You can try this code, i had it lying around, so i hope it still works, havent had to do such things in a long time:

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String input = br.readLine();
    System.out.println(input);
    br.close();
JameB commented: thanks! +1
Thirusha 20 Posting Whiz

No one is going to just give you the answer to the assignment, start coding something, and come back when you get stuck

Thirusha 20 Posting Whiz

You are missing the column names.
See adatapost's post giving an example of the insert statement.

Your statement should look something like this:

INSERT INTO registration1 (registrationno, firstname,.....) VALUES('"+s0+"','"+s1+"'....)
Thirusha 20 Posting Whiz

when using request.getParameter, the parameter must be in the url.
so make sure when u call the servlet the name of the button has been sent and the url will look something like this

/someservlet?buttonname=xyz
Thirusha 20 Posting Whiz

You are missing the onreadystatechange property, you will need this to receive the data returned from the server
It should look similar to this.

url+=idField.value;
req.open("GET",url,true);
req.onreadystatechange = function() {
        if (req.readyState == 4) {
            document.getElementById('userIdMessage').innerHTML = req.responseText;
        }
}
req.send(null);
Thirusha 20 Posting Whiz

try using the RequestDispatcher object

Thirusha 20 Posting Whiz

One way to do that is set a session attribute

Thirusha 20 Posting Whiz

Your function Res() is incorrect, firstly there is no element named "opinion", so the function is failing on the first line:

opinion.value="";

Your code to "reset" the radio buttons is correct but you need to reset all of them, currently you are only resetting one

document.getElementById("op1").checked=false;

, for three radio buttons it is fine to do them individually, but if u have more it would be better to loop through the buttons and reset them.

Try this:

document.getElementById("op1").checked=false;
	  document.getElementById("op2").checked=false;
	  document.getElementById("op3").checked=false;