Input field for Percent.

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
jauson
Forum Contributor
Posts: 111
Joined: Wed Oct 05, 2011 12:59 am

Input field for Percent.

Post 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?
Gopesh
Forum Contributor
Posts: 143
Joined: Fri Dec 24, 2010 12:48 am
Location: India

Re: Input field for Percent.

Post by Gopesh »

Hi,Didn't understand what's ur problem?
jauson
Forum Contributor
Posts: 111
Joined: Wed Oct 05, 2011 12:59 am

Re: Input field for Percent.

Post by jauson »

it show Nan to my result field when i click one of the button in my code above.
Gopesh
Forum Contributor
Posts: 143
Joined: Fri Dec 24, 2010 12:48 am
Location: India

Re: Input field for Percent.

Post by Gopesh »

Hi,what are u actually needto do? without seeing the full html code it is difficult to understand ur problem.
jauson
Forum Contributor
Posts: 111
Joined: Wed Oct 05, 2011 12:59 am

Re: Input field for Percent.

Post 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,
Gopesh
Forum Contributor
Posts: 143
Joined: Fri Dec 24, 2010 12:48 am
Location: India

Re: Input field for Percent.

Post 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...
jauson
Forum Contributor
Posts: 111
Joined: Wed Oct 05, 2011 12:59 am

Re: Input field for Percent.

Post by jauson »

i mean javascript. :)

thank you
Post Reply