I implemented a slack bot with um field of type input(multi_users_select). I would like to remove defaults apps from the list select?
{
type: 'input',
element: {
type: 'multi_users_select',
action_id: input.actionId,
initial_users: input.initial_users,
},
label: {
type: 'plain_text',
text: input.text,
emoji: input.emoji,
},
};
Instead of type: 'multi_users_select' use "type": "multi_conversations_select" with filter as shown below to get only users in your workspace.
You can copy and paste the below code in block-kit builder to test on your own.
https://app.slack.com/block-kit-builder/
{
"title": {
"type": "plain_text",
"text": "Blocker-Bot"
},
"submit": {
"type": "plain_text",
"text": "Submit"
},
"type": "modal",
"callback_id": "custom_time_select",
"private_metadata": "private-data",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Test block with multi conversations select"
},
"accessory": {
"type": "multi_conversations_select",
"placeholder": {
"type": "plain_text",
"text": "Select conversations",
"emoji": true
},
"filter": {
"include": [
"im"
],
"exclude_bot_users": true
},
"action_id": "multi_conversations_select-action"
}
}
]
}
Update 05-Jul-21
Included various other types of select users without bots/apps
{
"type": "modal",
"title": {
"type": "plain_text",
"text": "My App",
"emoji": true
},
"submit": {
"type": "plain_text",
"text": "Submit",
"emoji": true
},
"close": {
"type": "plain_text",
"text": "Cancel",
"emoji": true
},
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Conversations type Select user"
},
"accessory": {
"type": "conversations_select",
"placeholder": {
"type": "plain_text",
"text": "Select a user",
"emoji": true
},
"filter": {
"include": [
"im"
],
"exclude_bot_users": true
},
"action_id": "users_select-action"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Multi Conversations type Select users"
},
"accessory": {
"type": "multi_conversations_select",
"placeholder": {
"type": "plain_text",
"text": "Select conversations",
"emoji": true
},
"filter": {
"include": [
"im"
],
"exclude_bot_users": true
},
"action_id": "multi_conversations_select-action"
}
},
{
"type": "input",
"element": {
"type": "multi_conversations_select",
"placeholder": {
"type": "plain_text",
"text": "Select users",
"emoji": true
},
"filter": {
"include": [
"im"
],
"exclude_bot_users": true
},
"action_id": "multi_users_select-action"
},
"label": {
"type": "plain_text",
"text": "Input type Select users",
"emoji": true
}
}
]
}
Currently, filtering is available for conversations select menu or conversations multi select menu.
https://api.slack.com/reference/block-kit/composition-objects#filter_conversations
May be you can write to feedback#slack.com and they can log it for future releases.
Related
I want to create a new component having the user selected number of records of a collection type named articles . I dont need the user(admin) to select the related articles but only the number of published recent .
i have done this in my json file
{
"kind": "collectionType",
"collectionName": "pages",
"info": {
"singularName": "page",
"pluralName": "pages",
"displayName": "Page",
"description": ""
},
"options": {
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"title": {
"type": "string",
"pluginOptions": {
"i18n": {
"localized": true
}
},
"required": true
},
"description": {
"type": "text",
"pluginOptions": {
"i18n": {
"localized": true
}
}
},
"page_components": {
"type": "dynamiczone",
"components": [
"sections.hero",
"sections.section-with-buckets",
"sections.section",
"sections.section-with-cards",
"sections.rich-text",
"sections.section-with-articles"
],
"pluginOptions": {
"i18n": {
"localized": true
}
}
},
"seo": {
"type": "component",
"repeatable": false,
"pluginOptions": {
"i18n": {
"localized": true
}
},
"component": "meta.metadata",
"required": true
},
"url": {
"pluginOptions": {
"i18n": {
"localized": false
}
},
"type": "string",
"regex": "^$|^[a-zA-Z/-]+$"
}
}
}
but i want to be able to fetch the n number of recent articles which is another collection type
I'm trying to add a custom property that will hold a boolean for check if a response change should display a popup.
This is a part of my survey.json:
{
"type": "radiogroup",
"name": "q1",
"title": {
"default": "Question number one?"
},
"displayAlert": true,
"isRequired": true,
"choices": [
{
"value": "yes",
"text": {
"default": "Yes"
}
},
{
"value": "no",
"text": {
"default": "No"
}
}
]
}
As you can see there is a displayAlert property.
I want to read this property when there is a change in that answer:
this.userSurvey.onValueChanging.add((survey: any, change: any) => {
console.log('alert?', change.question.displayAlert);
});
I've also set this but it don't work:
Serializer.addProperty('itemvalue', {
name: 'displayAlert',
category: 'general',
});
Thanks in advance.
You need to add a property not to itemValue, but to the question type.
Survey.Serializer.addProperty("question",
{
name: 'displayAlert',
category: 'general',
}
)
var json = {
"pages": [
{
"name": "page1",
"elements": [
{
"type": "radiogroup",
"name": "q1",
"title": "Question number one?",
"displayAlert": true,
"isRequired": true,
"choices": [
{
"value": "yes",
"text": {
"default": "Yes"
}
},
{
"value": "no",
"text": {
"default": "No"
}
}
]
}
]
}]
};
...
survey.onValueChanging.add(function(survey, change) {
console.log('alert?', change.question.displayAlert);
});
Try this example: https://plnkr.co/edit/ggW5NkqCWdoSHfZ6.
I am using reactjs-form-builder for generating forms in react js my fields object is
this.state = {
id: null,
loading: true,
fields: {
"fields": {
"name": {
'label': "Product Name",
"type": "text",
"required": true,
"placeholder": true,
}
"submit": {
"type": "submit",
"label": "Edit Product",
"color": "btn-primary",
}
}
}
};
How do i set value to field name.
Just add value in you field object.
"name": {
'label': "Product Name",
"type": "text",
"required": true,
"placeholder": true,
"value": "You value here",
}
I am trying to create a form using the Angular JSON Schema Form. I want one field (dropdown1) to be required when another field (number1) is populated. I am able to get the following form + schema working in the SchemaForm.io Sandbox, but when I put it into my site, the dropdown field is missing.
Here is my schema:
{
"type": "object",
"properties": {
"isChecked": {
"title": "checked?",
"type": "boolean"
},
"text1": {
"title": "text1",
"type": "number",
"minimum": 0,
"maximum": 100,
"condition": "model.isChecked"
},
"number1": {
"title": "number1",
"type": "number",
"minimum": 0,
"condition": "model.isChecked"
},
"dropdown1": {
"title": "",
"type": "string",
"enum": ["Days", "Months", "Years"],
"condition": "model.isChecked"
},
"comment": {"type": "string", "Title": "Comment"}
}
}
Here is my form:
[
"isChecked",
{
"key": "text1",
"type": "decimal",
"validationMessages": {
"maximum": "text1 must be 100 or lower.",
"minimum": "text1 must be 0 or higher.",
"required": "This field is required"
},
"required": false
},
{
"key": "number1",
"type": "number",
"validationMessages": {
"minimum": "number1 must be 0 or higher."
},
"required": false
},
{
"key": "dropdown1",
"required": false,
"condition": "model.number1 === null"
},
{
"key": "dropdown1",
"required": true,
"condition": "model.number1 > 0",
"validationMessages": {
"required": "dropdown1 is required."
}
},
{
"key": "comment",
"type": "textarea"
}
]
You can use the "dependencies" property (https://json-schema.org/understanding-json-schema/reference/object.html#property-dependencies). The example requires billing_address to be present when a credit_card is provided:
{
"type": "object",
"properties": {
"credit_card": {
"type": "number"
},
"billing_address": {
"type": "string"
}
},
"dependencies": {
"credit_card": [
"billing_address"
]
}
}
This implementation supports "dependencies":
https://github.com/dashjoin/json-schema-form
You can check out the online example here:
https://dashjoin.github.io/#/example/dependencies
Here is the solution I found:
"condition": {
"functionBody": "return model.number1 === undefined && model.isChecked"
}
I'm unsure as to why an input field shows on the form when implementing this code.(ref: https://github.com/JamesGuthrie/angular-schema-form-signature)
This is my Schema:
{ "type": "object", "properties": { "signature": { "type": "string" } } }
This is my Form:
[
"name",
{
"type": "tabs",
"tabs": [
{
"title": "Tab1",
"tabType": "top",
"items": [
{
"title": "Signature",
"key": "signature",
"type": "signature",
"width": 500,
"height": 100,
"resetButtonText": "Clear signature"
}
]
}
]
}
]