Greetings. 

I have a need to give users the ability to decide, which fields should be required for a particular page. I had some sort of the solution in my head. It makes an request and returns with a list of fields that need to be required for this particular page. The problem I am facing is making fields required via JS code (not in Diff section but in the code section, like "onEntityInitialized"). Looking forward to seeing the possible ways to solve this problem.

Like 0

Like

1 comments

Hello,

In order to make a field required based on the condition you need to bind it to an attribute, here is an example of how to do it:

1) Create a new boolean attribute

attributes: {
			"IsValueRequired": {
				"dataValueType": Terrasoft.DataValueType.BOOLEAN,
				"value": false
			}
		},

2) Bind this attribute to an "IsRequired" parameter in the field diff:

"values": {
					"isRequired": {"bindTo": "IsValueRequired"},
					"layout": {

3) Set the value to this attribute in the onEntityInitialized method:

methods: {
			onEntityInitialized: function() {
				this.callParent(arguments);
				this.setIsValueRequired();
			},
			setIsValueRequired: function() {
				if (YOUR CONDITION) {
					this.set("IsValueRequired", true);
				}
				else this.set("IsValueRequired", false);
			}
		},

 

Show all comments

Is it possible to set up text placeholder for textareas without querying the DOM and applying it manually?

Like 0

Like

6 comments

Could you, please describe your case in more details?  Also, any examples/screenshots will be appreciated

Tetiana Markova,

When I have a text field like this:

I want to have some text inside it while the user has not filled it yet, like when using standard placeholder attribute on an input field:

Carlos,

Thank you for your specification.

You need to define "placeholder" property for your element in the diff array. Please, see my example for JobTitle field in the ContactPageV2 schema:

{

    "operation": "merge",

    "parentName": "ProfileContainer",

    "propertyName": "items",

    "name": "JobTitleProfile",

    "values": {

        "bindTo": "JobTitle",

        "controlConfig": {

            "className": "Terrasoft.TextEdit",

            "placeholder":{

                "bindTo": "Resources.Strings.Placeholder"

            },

            "classes": ["placeholderOpacity"]

        }

    }

}

You can also find other examples in the base packages.

 

Tetiana Markova,

Thank you very much, it works nicely.

where i have to write my input value?

1)Or enter the string resource on the page or enter directly (2nd option)

Localized strings and images are the resources of the client schema that are most often used in the implementation logic of the module.

Add resources to the client schema in the [Structure] tab of the client schema designer. The application core automatically generates a special [Client module name]Resources module, which contains resources of the client module. The localizableStrings property stores schema's localized strings. The images property stores image resources.

In order to access a resource module from a client module, you need to import the resource module as a dependency into the client module.

Use resource string:

"placeholder":{

                "bindTo": "Resources.Strings.Placeholder"

            },

2) directly

 "placeholder": "I'am empty"

 

Show all comments

Hello community!!

I need apply a style to the left container but don't know who.

The idea is have the label and control align to left on all controls of the container.

Any style to apply this??

Like 0

Like

3 comments

Please find the answer on how to add a custom style to a page in the article by the link below.

https://community.bpmonline.com/questions/how-add-custom-style-control-…

Thanks Eugene Podkovka, exist a sample on the system to inherit?

It's not possible to inherit styles.

Show all comments