How can I set a default input value in a repeater with Directus 9? - directus

If you have a input field one can set a default value.
If we add an input field in a repeater, we cannot set a default value.
Is it possible to set it somehow?

You can set default value of the whole object on Schema tab of the repeater field. You can try to put there value only on one of the subfields, for ex. { subfield_key: "value" }

Related

minLength textField attribute in Flutter

I'm trying to create a password textfield and I want the user to enter at least 8 characters. I really like the way the visible maxLength character counter on textfields work when a maxlength is set, and I was wondering if there is any equivalent for a minimum length. Thanks!
You have to use TextFormField instead of TextField.
Check this SO post:
For Text Field Validation use TextFormField instead of TextField.
TextFormField needs to be wrapped with Form widget (If there are
two ore more textformfields you can wrap their parent widget with form
widget).Form widget requires key and autovalidate boolean (it's
optional but it's recommended to show message to user when they
haven't validated and as soon as they validate message stops showing).
We create two variables and assign it to Form.Then we need a
validator in which we validate according to our requirements.(If you need to add more validations you can add multiple if
conditions.).Finally on field submitted we check if user has validated
the form if validated we perform our desired action else we set
autovalidate variable to true to perform autovalidation.
E.g.
TextFormField(
...
validator: (String value) {
return value.length < 8 ? 'Minimum character length is 8' : null;
}
)

Disable Vue Bootstrap Table Header Renaming

I am using b-table on vue-bootstrap using this code:
b-table :fields="queryResult.columns" :items="queryResult.rows"
The field is like this: id, column_name, column_hide
But, it automatically generates 'translated' header name, column_name to Column Name.
Is there any way to disable 'auto-renaming' on that table header ?
According the documents, there is a label attribute that can be set on the fields prop
Appears in the columns table header (and footer if foot-clone is set).
Defaults to the field's key (in humanized format) if not provided.
It's possible to use empty labels by assigning an empty string "" but
be sure you also set headerTitle to provide non-sighted users a hint
about the column contents.

How to make a textbox readonly/editable in angular 2 based on some condition

I have a textbox, I want to make in readonly at some conditions and editable field in few conditions, So the field should toggle between read only/editable based on the condition , How to achieve this ?
You need to use the following (Angular 4):
<input [readonly]="isReadOnly">
If you use attr.readonly then the input will always be read-only because the readonly attribute will be present even if its value is false. By using [readonly] Angular will only place the attribute if isReadOnly is true.
After, you assign the value as you wish:
// when you want to be read-only
isReadOnly = true;
// whe you want to be editable
isReadOnly = false;
Use this: [readonly]="varInYourComponent" in your input field, on template.
And in your component declare and you should work with this variable:
boolean varInYourComponent
use property binding to achieve that
[property]="flag"

How to set string to datetime widget?

The title is self explanatory. I am having difficulties setting a string value to a date time widget.
XCP has a build in function stringToDate
which i use in these examples...
1. stringToDate('5-5-2009')
2. stringToDate('05-05-2009')
3. stringToDate('5/5/2009')
But non of them work. What am I missing here ?
Also i set the value of the widget in the behaviors tab of the date widget.
If you are talking about Date-Time Input widget then you need to use dateToString not stringToDate.
I figured out the issue. It's dependent to the format in which you save your date to string value. If we save the Date-Time Input widget value in this format:
dateToString('12-12-2018', 'm-d-Y')
then doing a :
stringToDate(savedvalue) will work only when the format saved was 'm-d-Y'. It wasn't working before because i saved it as 'd-m-Y'.

Retrieve s:hidden value and add as a param to an url

I have an hidden input field which value changes according to the option selected in a s:select in Struts 2. Then, there's a button that points to an action like loadData.action.
I would like to add to this action a parameter named item.id with the value of the hidden field as its value, a value changing each time I select a new option.
I've tried to use an s:param with an s:property inside and the name or the id of the s:hidden, but it doesn't print the value after the = sign.
How can I do to achieve this result? loadData.action?item.id=12 where 12 is the value of s:hidden name="item" id="item" ?
Please Provide complete action link and which value to be change also your HTML structure, so it will be easy to answer your question
Assuming your HTML structure's elements, I have tried to answer your question
You can change action using jQuery on change event of your <s:select>
Have a look at https://jsfiddle.net/shantaram/qy9rew4v/
$('#id-select').change( function () {
var newAction = $('#id-form').prop('action');
newAction = newAction.substring(0, newAction.lastIndexOf('='));
$('#id-form').prop('action', newAction+"="+varItemId);
//varItemId is value of your hidden field
//which you want to change Dynamically
});
provided:
id-select -> Id of your <select> element
id-form -> Id of your <form> element