Page 1 of 1

Input field for Percent.

Posted: Thu Feb 16, 2012 10:24 pm
by jauson
Helo,

What best field to validate persentage value. see below code.

Code: Select all

function updatesum() {
document.form.rate.value = (document.form.perday.value -0) / (document.form.workhours.value -0) * (document.form.type.value -0) * (document.form.hours.value -0);
}

HTML

Code: Select all

<td>Type</td>
<td><input type="radio" name="type" id="type" value=".20" onChange="updatesum()"/> .20 <br />
<input type="radio" name="type" id="type" value=".10" onChange="updatesum()"/> .10 <br />
<input type="radio" name="type" id="type" value="0.013" onChange="updatesum()"/> 0.013 <br />
<input type="radio" name="type" id="type" value="0.0125" onChange="updatesum()"/> 0.0125 <br /> </td>
When I parse the page. result is NAN. I think Javascipt didnt recognize my code (for TYPE). Any idea?

Re: Input field for Percent.

Posted: Thu Feb 16, 2012 10:46 pm
by Gopesh
Hi,Didn't understand what's ur problem?

Re: Input field for Percent.

Posted: Thu Feb 16, 2012 11:23 pm
by jauson
it show Nan to my result field when i click one of the button in my code above.

Re: Input field for Percent.

Posted: Thu Feb 16, 2012 11:35 pm
by Gopesh
Hi,what are u actually needto do? without seeing the full html code it is difficult to understand ur problem.

Re: Input field for Percent.

Posted: Fri Feb 17, 2012 12:42 am
by jauson
Hi,

thanks all for the post. I actually done this job. the problem is my field and the value on it thats why java did not recognize the value perfectly.

Regards all,

Re: Input field for Percent.

Posted: Fri Feb 17, 2012 1:13 am
by Gopesh
Ok,Glad to see ur problem is solved..
why java did not recognize the value perfectly
Java is entirely different from javascript .Bye...

Re: Input field for Percent.

Posted: Fri Feb 17, 2012 1:48 am
by jauson
i mean javascript. :)

thank you