d3v4 — 2011-04-09T18:49:52-04:00 — #1
I have four form fields that should be autocompleted based on the input of the user, in the following way: when the first field is filled in, the second field should be filled with the first one's value * 2. When the 3rd field is filled, the fourth one should be filled with this third value * the first one.
I have no problems with the first two fields, but the third and fourth one keep returning 0 as a result.
var $val1 = 0;
var $val2 = 0;
$val2 = parseInt($(this).val());
paul_wilkins — 2011-04-09T23:07:11-04:00 — #2
Your code works for me, apart from seeing NaN when you first click in an empty field.
You may have to provide a sample test page that allows us to experience the same issue that you're facing.
d3v4 — 2011-04-10T04:47:52-04:00 — #3
Sure, here you go: Area Linea Domus - Login
Credentials are: test test
Go to the bottom of the page, there is only one row, click on Edit. Now if I insert, let's say, 2 into Coppie, Persone becomes 4, but if I write 20.00 into Contributo a coppia, Contributo serata remains 0 (it should be 20.00 * 2).
paul_wilkins — 2011-04-10T04:57:23-04:00 — #4
The script seems to be in file called calcoloautomatico.js
Could the reason be due to the keyup code for that second field being commented out?
d3v4 — 2011-04-10T05:34:07-04:00 — #5
Sorry, I forgot to update the code in the online version. The content of calcoloautomatico.js is the one I've posted in my first post in this topic. Even if nothing is commented out, I get the same problem.
paul_wilkins — 2011-04-10T05:36:33-04:00 — #6
When trying to edit, there is now the message:
"Non è possibile modificare un incontro di cui non si è il relatore."
d3v4 — 2011-04-10T06:03:22-04:00 — #7
It should work now
paul_wilkins — 2011-04-10T06:07:29-04:00 — #8
That seems to work now.
d3v4 — 2011-04-10T06:31:14-04:00 — #9
Well, you are lucky, because it doesn't work for me lol
paul_wilkins — 2011-04-10T06:42:08-04:00 — #10
Okay, I'll now move from trying in Chrome to trying in IE.
yes, it works for me in IE too. Perhaps your web browser is still caching the old version?
d3v4 — 2011-04-10T07:32:55-04:00 — #11
It was a cache problem Thanks!