views:

34

answers:

1

First i have declare that i am new to javascript. I have created a form that gets Id, Name, Age & Dept. I want it to send to java class and i have to show back the data along with the other data in the data Base using DWR.

For this i already done coding for showing the table, below that i have my form. After the form "Save" button calls the below function save(). Here, my form and function.

The Form:

Id:<input type="text" id="id"/><br>
Name:<input type="text" id="name"/><br>
Age:<input type="text" id="age"/><br>
Dept:<input type="text" id="dept"/><br>
<input id="Save" type="button" value="Save" onclick="save()"/>

The function:

function save(){
employee = new Object();
employee.id = dwr.util.getValue(iD);
employee.name = dwr.util.getValue(namE);
employee.age = dwr.util.getValue(agE);
employee.dept = dwr.util.getValue(depT);

dwr.engine.beginBatch();
Employee.aouEmployee(employee);  //   **Java method call to store data in DB**
fetch();//An another function which loads all the data in the table.
dwr.engine.endBatch();
}

But, i cant get proper output for the above function. I am also cant able to find the mistakes(due to no error msgs)

Any suggestions will be more appreciative

Thanks

UPDATES ARE HIGHLIGHTED BY BOLD

A: 
  1. Install Firefox, if you haven't already
  2. Install Firebug
  3. Use Firebug to debug JS, as well as its Net panel to debug AJAX calls; use console.log(string) to get feedback
  4. Profit.

By the way, for my curiosity: what's up with capitalising the last letter in a variable?

Amadan
NooBDevelopeR
They can, but it's a very bad design if they're allowed to. All libraries worth their salt hide their variables so they are not visible (or overwritable) from the outside, using objects and closures. Thus, I would be very much surprised if DWR showed any variables besides `dwr`.
Amadan
So, you know DWR. Ok, Anyway firebug rocks. Especially the break point. Thanks!!!
NooBDevelopeR
Nope, no idea about DWR, this post is the first time I ever heard of it. But I have a little bit of experience with JS. And yes, Firebug rocks.
Amadan