ConfiForms Rules for Field Definition set value for Textarea/Markdown field empty on form submit
Asked by Brian Karst:

I have been trying to set up a rule that will insert a default value for a textarea/markdown field in a form if a user leaves it empty. I am using the 'Set value if empty' Action and have tried many different combinations of field names (including blank) and conditions to check. What I keep running into is this.

If I leave Execute only on user action unchecked, the rule functions, but also populates the form with the default '{color:red}\<insert Bleh Bleh Bleh\>{color}.

I would like to keep the field empty on the form and only input the default on submit of the form so the default value will get inserted into the description.

If I check Execute only on user action, the rule doesn't appear to function. The field is empty, and nothing gets placed into the description when the form is submitted, unless I track another field and do something with it and then it gets placed into the field before the form is submitted.

Is there a way to track the submit/register button in the rule? Is there another way to accomplish this? I was going to look into replacing the register button with an action button or something


Answers:
author: Alex Medved _ConfiForms_
body: Add the condition to this rule to check if the field is empty (to ensure it is executed only in appropriate case)

comments: author: Brian Karst
body: I have been using the empty condition, maybe some of my attempts and results will better clarify

------------------------------------  

Field Name: eventdescription

Condition: eventdescription:\[empty\]

Execute only on user action: unchecked

Action to execute: Set Value if empty

Values to set: eventdescription={color:red}\<Insert Activity Description here\>{color}

Result: Event description field has "{color:red}\<Insert Activity Description here\>{color}" prefilled in form (failure). Event description section in issue description has "\<Insert Activity Description here\>" in red text (success)

-----------------------------------

Field Name: eventdescription

Condition: eventdescription:\[empty\]

Execute only on user action: checked

Action to execute: Set Value if empty

Values to set: eventdescription={color:red}\<Insert Activity Description here\>{color}

Result: Event description field is blank in form (success). Event description section in issue description is blank (failure)

-----------------------------------

Field Name: (left blank)

Condition: \[entry.eventdescription\]:\[empty\]

Execute only on user action: unchecked

Action to execute: Set Value if empty

Values to set: eventdescription={color:red}\<Insert Activity Description here\>{color}

Result: Event description field has "{color:red}\<Insert Activity Description here\>{color}" prefilled in form (failure). Event description section in issue description has "\<Insert Activity Description here\>" in red text (success)

-----------------------------------------

Field Name: (left blank)

Condition: \[entry.eventdescription\]:\[empty\]

Execute only on user action: unchecked

Action to execute: Set Value if empty

Values to set: \[entry.eventdescription\]={color:red}\<Insert Activity Description here\>{color}

Result: Event description field is blank in form (success). Event description section in issue description is blank (failure)

-----------------------------------------

Field Name: (left blank)

Condition: eventdescription:\[empty\]

Execute only on user action: unchecked

Action to execute: Set Value if empty

Values to set: \[entry.eventdescription\]={color:red}\<Insert Activity Description here\>{color}

Result: Event description field is blank in form (success). Event description section in issue description is blank (failure)

-----------------------------------------

I just want the entry field to be empty for the user, but if it is empty - to place a default message as a "reminder" for them to fill in the information later as it becomes available.


author: Alex Medved _ConfiForms_
body: Well, I would say ConfiForms behaves correctly for the rules you setup (first rule setup is correct, others are not), but...

What you want - cannot be done via the rule... Because you want to set the value for a field ONLY after you have submitted the form

This needs to be done with a ConfiForms IFTTT with "Create/Update ConfiForms Entry" action

And that shall have a condition

```
eventdescription:[empty]
```

and the parameters to set would be something like

```
entryId=[entry.id]&eventdescription={color:red}<Insert Activity Description here>{color}
```


author: Brian Karst
body: That will work, thanks Alex. Learning more and more about these forms every day.


author: Lilian
body: Thanks Alex - this helped me set the default for radio buttons.


author: Joe66
body: [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630)   
Hi alex,  
I'm using confiform IFTTT Integration rules macro to update a particular field Status to give an error message as the updated entry incase the name field doesn't have any value in its entry.  

**Event:** onModified  
**Choose action:** Create/Update confiform entry  
**Fire IFTTT Action:** name:\[empty\] AND Status.label:success  
**Parameters to set:** entryId=\[entry.id\]\&Status.label={color:red}"Error:Cannot choose success with empty name value"{color}  

the color isn't working for me. However, the error message is getting updated in the particular entry but its not in red. Need some help here.  

Thanks.

comments: author: Alex Medved _ConfiForms_
body: Is your status field is a markdown type (field)?


author: Joe66
body: It is of Status type (field) with dropdown options success, fail, progress. So for a particular record, when I choose success from the dropdown in the status field in the tableview macro when the name field is empty, the particular entry in the status field would get changed to "Error:Cannot choose success with empty name value". But I was hoping the text color would get changed to red but didn't work. Is it not possible to change using {color:red} or something similar when setting the parameter value ?


author: Alex Medved _ConfiForms_
body: You can only set it to one of the status values you have defined....

(a value, not a label - and values for the status field are predefined for each supported color - see status field in <https://wiki.vertuna.com/display/CONFIFORMS/Documentation>)


author: Yangyang Liu
body: Hi Alex,

I have tried this. Thanks, it works.

However, when I set the "Reference to form and its location" to be the exact same form on the same page, two separate data entries would be saved from only one form submission. In another word, a single click on the "Save" button would submit the form twice.

![??2021-01-28 ??12.11.16.png](https://community.atlassian.com/t5/image/serverpage/image-id/127772i44C3F217BE5DBAB0/image-size/large?v=v2&px=999 "??2021-01-28 ??12.11.16.png")

I just wish how can the IFTTT "Create/Update ConfiForms Entry" action Update data into the same data entry as the one submitted using the "Save" button?

(How can the record be one instead of two upon each form submission?)

Thanks,

comments: author: Alex Medved _ConfiForms_
body: Do you set

```
entryId=[entry.id]
```

in your parameters for the "Create/Update ConfiForms Entry" IFTTT action?

See the description for this action and it tells you to set the ID parameter (as mentioned above) to perform an "update"

Alex


author: Yangyang Liu
body: Oh, I have not actually.

I just tried adding this to the parameter and it works fine!

Thanks!

Yangyang


Tags: cloud

confiforms