I'm trying to retrieve the value of the typed field in a row of an Eureka form (https://eurekacommunity.github.io). I've set up a new textfield with a mask, but when I send it back it returns me empty.
TextRow:
<<< TextRow(Constants.CPF) {
$0.title = Constants.cpf_title
$0.placeholder = Constants.cpf_placeholder
}
.cellSetup { cell, _ in
let tf = JMMaskTextField(frame: cell.textField.frame)
tf.maskString = "000.000.000-00"
cell.textField.removeFromSuperview()
tf.translatesAutoresizingMaskIntoConstraints = false
cell.textField = tf
cell.contentView.addSubview(tf)
}
.cellUpdate { cell, _ in
cell.textField.delegate = self
}
Result:
let values = self.form.values()
print(values[Constants.CPF])
Optional(nil)
Apparently the mask is working properly, but I think I'm forgetting to set something up. Does anyone have any ideas?
If you want to use different UITextField
in your row, you should create custom row for that. In this case, you can subclass from TextRow
and implement you cell with JMMaskTextField
. Just remove default textField
and set the new (as you did) doesn't work.