The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Append information to rich text field with/without conditional

Labels

This Discussion is public

Notifications

I had to append information to a rich text field if a certain condition was met.  Formidable by default only allows you to create a conditional to show/hide the field.  So, I had to use a custom code to check for the conditional and if the conditional was met to provide some default text to the end of the field when it was submitted.

The code is as follows:

add_filter('frm_validate_field_entry', 'note_taker', 8, 3);
function note_taker($errors, $field, $value){
if($field->id == 25){                                              //replace "25" with the corresponding field where you would like the text to be placed
$notes="This is where the message you want displayed is placed";    //enter the phrase you would like append to the paragraph text
if ($_POST['item_meta'][26] <= 4) {          //replace "26" with the corresponding field you are basing the condition off of and the condition that has to be met
$_POST['item_meta'][25]=$_POST['item_meta'][25]."---------------"."$notes";    //This appends to the end of the paragraph text.  If the condition is met it will append the notice at the end of the field.  If someone does enter text it will appear as normal and then the message you would like to follow AFTER it is submitted.
}
}
return $errors;
}

If you would like to submit text behind the rich text without a conditional you can use this code:

add_filter('frm_validate_field_entry', 'note_taker', 8, 3);
function note_taker($errors, $field, $value){
if($field->id == 25){                                              //replace with the corresponding paragraph text field
$notes="This is where your text is placed";    //enter the phrase you would like append to the paragraph text
$_POST['item_meta'][25]=$_POST['item_meta'][25]."---------------"."$notes";    //This appends to the end of the paragraph text

}
return $errors;
}

 

Hope you enjoy and someone out there can use it!

 

 

Thank you very much.

It was a good starting point.

Discussion closed.