Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting initial value for input interactive element #1030

Closed
1 of 9 tasks
ido-vcita opened this issue Jun 7, 2021 · 6 comments
Closed
1 of 9 tasks

Allow setting initial value for input interactive element #1030

ido-vcita opened this issue Jun 7, 2021 · 6 comments
Labels
bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented question M-T: User needs support to use the project Version: 3x web-client
Milestone

Comments

@ido-vcita
Copy link

ido-vcita commented Jun 7, 2021

Please allow setting and initial value in input interactive element

Category (place an x in each of the [ ])

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.models (UI component builders)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.rtm (RTM client)
  • slack_sdk.signature (Request Signature Verifier)

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

@mwbrooks mwbrooks added question M-T: User needs support to use the project and removed untriaged labels Jun 7, 2021
@mwbrooks
Copy link
Member

mwbrooks commented Jun 7, 2021

Hi @ido-vcita 👋🏻 Block Kit already allows you to define an initial_value for input fields. Is this what you are hoping to do?

If you're having trouble, would you mind uploading a code sample to recreate the problem? Thanks!

@seratch
Copy link
Member

seratch commented Jun 8, 2021

@ido-vcita The model classes for block elements should have all initial_ properties: https://github.com/slackapi/python-slack-sdk/blob/v3.6.0/slack_sdk/models/blocks/block_elements.py If you find something missing, letting us know what it is would be appreciated.

@ido-vcita
Copy link
Author

ido-vcita commented Jun 9, 2021

I am getting the following message when try to initialize an InteractiveInputElement with initial_values:

import logging
logging.basicConfig(level='DEBUG')
from slack_sdk.models.blocks.block_elements import *
input_interactive =  InputInteractiveElement(action_id='test_action', type='plain_text_input', initial_value='test')

OUTPUT:
DEBUG:slack_sdk.models:!!! InputInteractiveElement's constructor args (initial_value) were ignored.If they should be supported by this library, report this issue to the project :bow: https://github.com/slackapi/python-slack-sdk/issues

Am I doing something wrong here?

@seratch
Copy link
Member

seratch commented Jun 9, 2021

@ido-vcita Ah, I see. We should improve the log message but it is a base class. Please use the PlainTextInputElement class instead: https://github.com/slackapi/python-slack-sdk/blob/v3.6.0/slack_sdk/models/blocks/block_elements.py#L999-L1046

seratch added a commit to seratch/python-slack-sdk that referenced this issue Jun 10, 2021
seratch added a commit to seratch/python-slack-sdk that referenced this issue Jun 10, 2021
@seratch
Copy link
Member

seratch commented Jun 10, 2021

Although using sub classes is recommended as I mentioned above, the warning logs you encountered do not tell anything meaningful. Thus, we'll remove them by this pull request. #1032 Thanks for your inputs here.

Also, if everything about this topic is clear now, would you mind closing this issue?

@ido-vcita
Copy link
Author

Thanks for the help, I appreciate it. Closing the case now

seratch added a commit that referenced this issue Jun 10, 2021
* Remove confusing warning messages #1030

* Fix test comments
@seratch seratch added this to the 3.7.0 milestone Jun 10, 2021
@seratch seratch added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented Version: 3x web-client labels Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented question M-T: User needs support to use the project Version: 3x web-client
Projects
None yet
Development

No branches or pull requests

3 participants