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

Support placeholders for inputs in an element template #852

Closed
mbiciin opened this issue Jan 13, 2023 · 7 comments
Closed

Support placeholders for inputs in an element template #852

mbiciin opened this issue Jan 13, 2023 · 7 comments
Labels
element templates enhancement New feature or request

Comments

@mbiciin
Copy link

mbiciin commented Jan 13, 2023

Is your feature request related to a problem? Please describe

I need to have a default value in some input fields, a value that will be filled automatically after I delete the value introduced manually. I tried to use the prefilled values, but they don't have this behavior. I did some tests and I saw that they are filled just once, after the update of the template in the diagram. If you change of it in the diagram, you won't be able to get back the default value. The modeler tries to keep the value introduced manually by the user.
There is also an exceptional case when the prefilled value is not updated in the diagram, even if you're using optional:

  • update the prefilled value in the template,
  • publish the template
  • open the diagram
  • change the value of the input field for which you're using the prefilled value
  • update the template
    We decide to use the prefilled values for the hidden fields that can't be changed by the user.

Describe the solution you'd like

  • Placeholders will be useful for input fields that will have the same value most of the time, but we want to let the user change it if needed.
  • The user will be able to change the value manually, but if this value is deleted, the user will have back the default value completed automatically.
  • The implementation of element templates should live in https://github.com/bpmn-io/bpmn-js-properties-panel.
  • We consider the placeholders (https://www.w3schools.com/tags/att_input_placeholder.asp) useful for the custom element templates that we plan to support in the future.
    Describe alternatives you've considered
    For now, as a workaround, we add notes and documentation links in the description of the fields.

Additional context
These custom templates have to be very user friendly so the placeholders will be a great feature in some cases.

@mbiciin mbiciin added the enhancement New feature or request label Jan 13, 2023
@marstamm
Copy link
Contributor

Hi @mbiciin , thank you for opening this issue. What Problem are you trying to fix with placeholders?

It is possible to add default values to element templates by setting the value property. Does this already solve your problem?
image

Please also adjust the Ticket to use the Feature Request Template, so everyone can follow your train of thought.

Cheers!

@nikku nikku added element templates help wanted Extra attention is needed labels Jan 13, 2023
@mbiciin
Copy link
Author

mbiciin commented Jan 17, 2023

Hi @marstamm

I updated the ticket. Please, let me knw if you need more details.

@marstamm
Copy link
Contributor

Thank you for updating the Issue, this makes the problem clearer. I see 2 separate issues you mentioned:

There is also an exceptional case when the prefilled value is not updated in the diagram, even if you're using optional:

Is this related to this Issue or would this be a separate Bug report? The behavior for updating templates is to not override changes by the user. If you believe this is wrong or unexpected, please open a Bug ticket so we can keep the discussions focused on one thing at a time 😄

Placeholders will be useful for input fields that will have the same value most of the time, but we want to let the user change it if needed.

To make sure I understand the use case correctly:

  • You have a Element Template with an input field, say Name
  • Name by default is Alice
  • I might want to change it to Bob
  • When I delete Bob and the input is empty, it should automatically use Alice as the default value again
  • The default value should be shown using the Placeholder attribute

Is this correct?

@nikku
Copy link
Member

nikku commented Jan 18, 2023

Placeholders will be useful for input fields that will have the same value most of the time, but we want to let the user change it if needed.

@mbiciin I'm not sure if that is what I expect of a placeholder. As far as I am concerned a placeholder gives me a hint on the (optional) semantic contents of a field. If the field assumes certain default value I assume it to be pre-filled with that default value.

So if I understand correctly we think about two things here:

  • Default values => Must be pre-filled
  • Placeholders, short visual hints what may be entered

Cf. MDN on placeholders:

The placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. It should be a word or short phrase that demonstrates the expected type of data, rather than an explanatory message.

@marstamm
Copy link
Contributor

marstamm commented Jan 18, 2023

+1 @nikku

The behavior described in #852 (comment) would rather be achieved with an initially empty input, where the default value is applied either in the backend service or through a hidden input mapping, not with a placeholder attribute

@nikku nikku added the backlog Queued in backlog label Jan 27, 2023 — with bpmn-io-tasks
@nikku nikku changed the title Support adding placeholders via element template config Support placeholders for inputs in an element template Jan 27, 2023
@nikku
Copy link
Member

nikku commented Jan 27, 2023

Guess placeholders (in the HTML sense) are still a valid feature request. Moving to backlog.

@nikku nikku removed the help wanted Extra attention is needed label Jan 27, 2023
@nikku
Copy link
Member

nikku commented Jun 4, 2024

Implemented via bpmn-io/bpmn-js-element-templates#92.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
element templates enhancement New feature or request
Development

No branches or pull requests

3 participants