Show red asterisk for required filed on form

  • 9 April 2019
  • 4 replies
  • 390 views

Dear guru

 

Could you please advise how can I set red asterisk (or remarkable symbol) for certain field as a required field on a form?

 

BR,

 

Peerasit

 

System: K2 Five

 

 


4 replies

Hello pejomsri,

 

You can implement this on a view level. For example, if you have a view that consists of an ID number as a required field, you could follow the steps below to mark it as "required" with an red asterisk.

Step 1

Just next to the required field, place a data label control. Adjust the textbox to provide space for the datalabel as shown on the image below.

 

 

 

I hope this helps you.

 

Should you find this post answer your question, please could you mark it as such by "Mark as solution" or "Kudo" as it will be of help to other members of the community who encounter the same issue.

 

regards,

Katleho

Hi  @pejomsri;

 

1 If your in designer, navigate to conditional formatting, Add Conditional formatting, e.g if textbox101 is empty(choose the operator) then click ok at the bottom it will direct you to the style builder then navigate to the custom method and select format(symbols and color) of your own.

 

Alternatives

You can use rules such that when certain button is clicked, validate required and you should be able to configure such that when event happen certain textbox(controls) are required and they will automatically marked red.

As shown in the below pictures.

 

Should you find the above information useful kindly mark as "Accepted Solution and/or Kudo", as this will assist other community members looking for related information.

 

Thank you.

 

Kind regards;

Widson

Another valid approach which I often use is the one outlined here:
https://how2k2.wordpress.com/2017/08/29/easily-add-to-required-field-labels-k2-smartforms/

Simply add this code to a data label, and make it literal: 

<style>
span.SourceCode-Forms-Controls-Web-Label[title*=": "]::after
{content:'*';color:red;}
span[title*=':'].SourceCode-Forms-Controls-Web-Label
{font-weight:bold !important}
</style>

Then on the labels of the fields which you wish to show the asterisk, add a semicolon and a space, like so ": " 

The script above will automatically add a red asterisk wherever it detects a semicolon and a space

Userlevel 2

Hello  @pejomsri,

 

There is in fact a way to require fields to be populated without creating individual rules for each one.
To do this you can utilize SmartForm validation, this documentation includes informaton on how to do this:
https://help.k2.com/onlinehelp/k2smartforms/userguide/current/default.htm#How_Tos/Add_Validation_to_a_SmartForm/Using_a_Validation_Pattern_and_Rule_Condition.htm

 

Along with this you can also use styling to denote fields that require information. To do this you can modify the data label for each field by doing the following:

1. Select the label for the field that requires validation. This may need to be changed on View level if the control is not on the Form.

2. In the Properties section of the label you will notice a section called 'Text', add an asterix to the end of the labels text to show that this is a required field.

3. In the same Properties section of the label select Styles.

4. On the Fonts tab, you can change the color of the labels text. In this case red.

5. Save the Form / View.

 

You should see the change in the texts color, showing that the field is required.

 

I hope this helps you out!

 

Regards,
BesM

 

[K2 will not accept any liability for any issues arising from actions taken in respect of the information provided by any forum member]

Reply