Is there an alternative to using the embed widget in Webflow to set a custom attribute for the value of a form text field, since the attribute name "value" is reserved? Can Webflow remove the value attribute from the reserved list, as they have done with other attributes like maxLength?

TL;DR
  • Use hidden fields with scripts in the Project settings to set desired values.
  • Utilize the CMS to bind dynamic data to form inputs without the value attribute.
  • Implement custom JavaScript/jQuery to programmatically set input values.
  • Submit feature requests to Webflow support for potential changes.

When dealing with custom attributes for form fields in Webflow, the value attribute is currently reserved and cannot be directly used as an attribute name for form text fields. Here are some alternatives you can consider:

1. Using Hidden Fields

  • Create a hidden form field: Add a hidden form element to capture a value that you want to submit with the form.
  • Set its value: Use custom script in the Before Body tag section found in your Project settings to set the desired value of the hidden field.

2. Use the CMS for Dynamic Values

  • Utilize the CMS (Content Management System): If you're displaying dynamic content, you can use CMS fields to bind dynamic data to form inputs.
  • Field settings: While attaching CMS data, set the configurable options according to your needs without using the value attribute.

3. JavaScript or jQuery for Dynamic Values

  • Add custom JavaScript: Insert a snippet in your page settings to dynamically set the input's value. This circumvents the need to use the value attribute directly.
  • Example implementation: Use custom script to select the input via its ID or class and set the value programmatically.

4. Contact Webflow Support

  • Feature requests: Although Webflow does listen to user feedback, there is currently no guarantee that the value attribute will be removed from the reserved list. Contact Webflow support or share feedback through their community forums to request this as a feature change.

Summary

To set a custom value for a form text field in Webflow, alternatives like using hidden fields, the CMS, or custom JavaScript can be employed. While Webflow has adjusted some reserved attributes in the past, the value attribute remains restricted. Support or feature requests can be submitted to potentially influence future changes by Webflow.

Rate this answer

Other Webflow Questions