Buy Now
Sign in

Text Field does not trim white space at the beggning or the end

omidhz , June 14 2017, 07:05
O
omidhz 295
June 14 2017, 07:05 #369383
I think Text fields in CF should have the php trim function by default. Right now, users can enter blank space at the beginning and end of their input.
How/where can I add this php code to my Text field?
GreyHead 64
June 14 2017, 15:39 #369407
 1
 Answer
Hi omidhz ,

You can clean up the data after the form is submitted using code like this in a Custom Code action:
<?php
$this->data['text1'] = trim($this->data['text1']);
?>

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much