Skip to content

Conversation

@plamco
Copy link
Contributor

@plamco plamco commented Nov 18, 2025

Description

This PR adds a new Placeholder setting to the TextField settings model.

Changes included:

  • Added Placeholder property to TextFieldSettings.cs
  • Updated TextFieldSettings.Edit.cshtml to expose the placeholder input in the admin UI
  • Passed the placeholder value through TextFieldFieldDriver
  • Updated editor template to render the placeholder value in the input field

Why:
The placeholder improves the editor experience by giving content authors contextual guidance when entering text values.

Testing

  • Configure a TextField inside a Content Type
  • Set a Placeholder value
  • Create or edit a content item using that type
  • Verify that the placeholder appears in the input field

Closes #18562

Video:
https://www.dropbox.com/scl/fi/61roa9rhdm25t292e9kgg/textfield_placeholder.gif?rlkey=f4moandkjkre8g4ofd4f30w9l&dl=0

This change introduces a new `Placeholder` option in `TextFieldSettings`
and exposes it in the field settings UI. The placeholder value is passed
through the TextField driver and rendered in the editor template so that
content authors can see it in input fields.
Refs OrchardCMS#18562
@github-actions
Copy link
Contributor

Thank you for submitting your first pull request, awesome! 🚀 If you haven't already, please take a moment to review our contribution guide. This guide provides helpful information to ensure your contribution aligns with our standards. A core team member will review your pull request.

If you like Orchard Core, please star our repo and join our community channels.

@plamco plamco marked this pull request as ready for review November 18, 2025 16:27
@plamco
Copy link
Contributor Author

plamco commented Nov 18, 2025

@dotnet-policy-service agree

@gvkries
Copy link
Member

gvkries commented Nov 19, 2025

Please check the other editors for the text field. I think some of them may also benefit from showing the placeholder text (e.g. email, phone, url, etc.).

@sebastienros
Copy link
Member

@plamco we would appreciate if you could do the same change on other fields that support this attribute. Maybe also update the existing editors that would support it.

@plamco
Copy link
Contributor Author

plamco commented Nov 25, 2025

@plamco we would appreciate if you could do the same change on other fields that support this attribute. Maybe also update the existing editors that would support it.

@sebastienros
I scanned all fields in OrchardCore that support an input UI.
The following fields already implement placeholder in a consistent way, so I left them unchanged: LinkField, NumericField.
Boolean fields logically have no placeholder.

These fields currently have hard-coded placeholders or partial implementations, so I refactored them to use the new Settings + Driver + Shape pattern:

- YouTubeField
- TitlePart
- ContentPickerField
- UserPickerField
- TagsField

Let me know if you'd like this PR to also cover any additional fields.

Default value of string.Empty has been added to Placeholder to prevent null reference issues in the UI

Testing / Demo:
A short video demonstrating the placeholders in action has been attached below. It shows how the placeholders appear in the edit forms for all updated fields and parts.

more_fields_added

@gvkries
Copy link
Member

gvkries commented Nov 27, 2025

Remember to include the appropriate editors for each field type.

For example, a text field can have an email editor, which outputs an HTML tag like <input type="email" ... >.
The placeholder text should also appear in this editor.

Editor-specific views follow the naming convention: [FieldType]-[Editor].Edit.cshtml

@gvkries gvkries merged commit ca5f8f0 into OrchardCMS:main Dec 8, 2025
5 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

Congratulations on your first PR merge! 🎉 Thank you for your contribution! We're looking forward to welcoming other contributions of yours in the future. @all-contributors please add @plamco for code.

If you like Orchard Core, please star our repo and join our community channels.

@allcontributors
Copy link
Contributor

@github-actions[bot]

I've put up a pull request to add @plamco! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Placeholder setting to TextField

3 participants