In one of my forms I need a variable (both as visible field and as part of an email sent) having a unique read-only value. The current date/time looks a good candidate to me.
I am using the simple setup mode (I once tried advanced, but could not get the form even displayed). I found how to make a field read-only (by adding readonly to the Extra Params), but I have difficulty in providing the correct value. I would prefer using the “Field Value” item in the General edit setup in order to keep the Designer option usable, but I don’t know how. I would expect there something like
but that is not understood. Instead I can go to the Code tab and change the value there:
That works, but disallows further easy editing using the Designer tab.
What should I do?
Regards
Peter
I am using the simple setup mode (I once tried advanced, but could not get the form even displayed). I found how to make a field read-only (by adding readonly to the Extra Params), but I have difficulty in providing the correct value. I would prefer using the “Field Value” item in the General edit setup in order to keep the Designer option usable, but I don’t know how. I would expect there something like
<?php echo date(“d-M,H:i:s”); ?>
but that is not understood. Instead I can go to the Code tab and change the value there:
value=<?php echo date(“d-M,H:i:s”); ?>
That works, but disallows further easy editing using the Designer tab.
What should I do?
Regards
Peter
Hi Peter,
You can set the value in a Custom Code action in the On Load event of the Setup tab (drag it up before the HTML (render form) action).
Bob
You can set the value in a Custom Code action in the On Load event of the Setup tab (drag it up before the HTML (render form) action).
<?php
$form->data['input_name'] = date('d-M,H:i:s');
?>
That will set the value for the input with the name input_name.
Bob
This topic is locked and no more replies can be posted.