Category

How to Increase the Description Character Limit in Web Forms and Widgets

Updated:

You can increase the maximum character limit of the Description field in a BoldDesk web form or web widget by adding custom JavaScript.

Before adding the JavaScript, configure the web form or web widget to use Contact form with ticket fields, and then select a ticket form that contains the Description field. The JavaScript can modify the character limit only when the Description field is available in the selected ticket form.

The following JavaScript sets the maximum character limit to 2000. Replace 2000 with the required character limit.

This article explains how to make the Description field available, add the custom JavaScript, and verify the updated character limit.

Prerequisites

Before adding the custom JavaScript, ensure that:

  • Your assigned role includes the Manage settings permission.
  • You have identified the maximum character limit required for the Description field.
  • The applicable web form or web widget uses Contact form with ticket fields.
  • The selected ticket form contains the Description field.

Increase the Description Field Character Limit in a Web Form

First, configure the web form to display the ticket fields from a selected ticket form. Then, add the custom JavaScript.

Make the Description Field Available

To make the Description field available in the web form:

  1. Go to Admin > Web Forms.

  2. Open the required web form.

  3. Under Form Option, select Contact form with ticket fields.

  4. Under Form, select the ticket form that contains the Description field.

  5. Click Update.

    Form_Option_Section_within_a_Web_Form_page.png

The web form displays the fields configured in the selected ticket form. Ensure that the Description field is included in that ticket form.

Add the Custom JavaScript

To configure the Description field character limit:

  1. Open the applicable web form.

  2. Go to Advanced Customization > Custom JS.

  3. Paste the following JavaScript:

    if (document.querySelector('#description_wrapper')) {
        document.querySelector('#description_wrapper').querySelector('textarea').maxLength = 2000;
    }
    
  4. Save the web form configuration.

    Custom_JS_section.png

Increase the Description Field Character Limit in a Web Widget

First, enable the contact form and configure it to display the fields from a selected ticket form. Then, add the custom JavaScript.

Make the Description Field Available

To make the Description field available in the web widget:

  1. Go to Admin > Web Widgets & AI Agent.

  2. Open the required web widget.

  3. Locate the Contact Form section.

  4. Enable the Contact Form toggle.

  5. Under Form Option, select Contact form with ticket fields.

  6. Under Form, select the ticket form that contains the Description field.

  7. Click Update.

    Contact_form_with_Ticket_fields_option.png

The web widget displays the fields configured in the selected ticket form. Ensure that the Description field is included in that ticket form.

Add the Custom JavaScript

To configure the Description field character limit:

  1. Open the applicable web widget.

  2. Go to Advanced Customization > Custom JS.

  3. Paste the following JavaScript:

    if (document.querySelector('#description_wrapper')) {
        document.querySelector('#description_wrapper').querySelector('textarea').maxLength = 2000;
    }
    
  4. Save the web widget configuration.

    Custom_JS_section_within_a_Web_widgets_page.png

The same JavaScript can be used in web forms and web widgets when the Description field uses the description_wrapper element.

Change the Description Field Character Limit

The value assigned to maxLength determines the maximum number of characters that customers can enter in the Description field.

The following configuration sets the limit to 2000 characters:

.maxLength = 2000;

To apply another limit, replace 2000 with the required value.

For example, to set the limit to 3000 characters, use:

if (document.querySelector('#description_wrapper')) {
    document.querySelector('#description_wrapper').querySelector('textarea').maxLength = 3000;
}

Use a positive whole number as the maxLength value.

Verify the Updated Character Limit

After saving the custom JavaScript:

  1. Open the applicable web form or web widget.
  2. Locate the Description field.
  3. Enter text in the Description field.
  4. Confirm that the field accepts text up to the configured character limit.
  5. Confirm that additional characters cannot be entered after the configured limit is reached.

Troubleshooting

The Description Field Is Not Available

Confirm that:

  • Contact form with ticket fields is selected under Form Option.
  • The correct ticket form is selected under Form.
  • The Description field is included in the selected ticket form.
  • The Contact Form toggle is enabled when configuring a web widget.
  • The web form or web widget configuration was saved.

The Description Field Character Limit Does Not Change

Confirm that:

  • The JavaScript was added under Advanced Customization > Custom JS.
  • The custom JavaScript was saved.
  • The Description field is available in the web form or web widget.
  • The maxLength value contains a positive whole number.
  • The JavaScript does not contain missing brackets, quotation marks, or other syntax errors.

Refresh the web form or web widget and test the Description field again.

The Wrong Character Limit Is Applied

Review the number assigned to maxLength.

For example:

.maxLength = 2000;

Replace 2000 with the required character limit, save the configuration, and test the field again.

Frequently Asked Questions

  1. How do I make the Description field available in a web form?
    Select Contact form with ticket fields under Form Option, and then select a ticket form that contains the Description field.

  2. How do I make the Description field available in a web widget?
    Enable Contact Form, select Contact form with ticket fields, and then select a ticket form that contains the Description field.

  3. Can I increase the Description field character limit in both web forms and web widgets?
    Yes. Add the custom JavaScript under Advanced Customization > Custom JS in the applicable web form or web widget.

  4. Can I use a character limit other than 2000?
    Yes. Replace 2000 in the JavaScript with the required positive whole number.

  5. Why is the Description field not displayed after adding the JavaScript?
    The JavaScript changes the character limit but does not add the Description field. Configure the web form or web widget to use Contact form with ticket fields, and select a ticket form containing the Description field.

  6. How can I confirm that the custom character limit is working?
    Open the web form or web widget and enter text in the Description field. Confirm that additional characters cannot be entered after the configured limit is reached.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied
Access denied
Access denied

No articles or sections found
No articles or sections found