Child repeating form default value

Mono

Member
I have a parent form with a repeatable child form.

I would like to have a field 'axle_number' with the default value of 1,
when user clicks [+] I would like the next copy of the form to contain 2
and so on.

PHP:
if ($data == '') {return 1;
} else {
return '{tbl_axle_details___axle_number}' + 1;
}

This is what I have tried in default value, but it only ever inserts the + 1
 
Try this, that's what i would do:

Code:
if ($data == '') {return 1;
} else {
$calc = (int)'{tbl_axle_details___axle_number}' + 1;
return $calc;
}
 
Thank you for that I'm new to php and wasn't aware of that function.

But my problem seems to be in the IF/ELSE part of the code, it never returns a '1' when the form is first opened.
But for that matter even if a 1 is inserted manually it doesn't do the calculation of adding another 1 when the form is repeated.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top