Please put console.log(o.val()); in your JavaScript code and run the test.
The console should show the output (look for INFO:CONSOLE).
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Using Dusk to test, I have the following javascript function attached to onchange/onblur events on an input field, to better format it into decimal:
reformat__quantity: function(o)
{
var v = parseFloat(o.val());
if (isNaN(v))
{
// it's always NaN, why?
v = 1.00;
}
else if (v <= 0)
{
v = 1.00;
}
v = v.toFixed(2);
o.val(v);
}
Trying to type a decimal value into the field via Dusk
->type('quantity', '3.71')
->type('quantity', 3.71) // same thing happen
parseFloat in js always gives NaN (and reformats to 1.00 here), but why? Using regular browser manually works as expected, the value shows up as 3.71 Removing this function from event helps with the test, but it is needed in real usage.
Please help.
Please or to participate in this conversation.