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());
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.
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).
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?
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.
When trying to edit, there is now the message:
"Non è possibile modificare un incontro di cui non si è il relatore."
It should work now
That seems to work now.
Well, you are lucky, because it doesn't work for me lol
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?
It was a cache problem Thanks!