# Pre Populate & Disable Date Range

> This example could be used for a booking tool; here, we will use a date range field with the timer option enabled instead of the end date and…

Source: https://tadabase.com/docs/snippets/pre-populate-disable-date-range  
Status: Not yet re-checked. Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.

![Screenshot for “Pre Populate & Disable Date Range”](https://community.tadabase.io/uploads/default/original/2X/7/729d270be022c394f7fb4aa3ddc56364e4046923.png)

This example could be used for a booking tool; here, we will use a date range field with the timer option enabled instead of the end date and pre-populate and disable the input (number) field and disable the select integer (minutes, hours, days) field.

**Step 1**

**Add a CSS class called “my-date-range” to the Date Range in the form**

![Screenshot for “Pre Populate & Disable Date Range”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1665354782340.png)

**Step 2**

**Find the Component ID of the Form.**

![Screenshot for “Pre Populate & Disable Date Range”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1665354827641.png)

**Step 3**

**Add the following code to the JavaScript tab of your page.**

> **Note:** Change ‘component_ID’ to your forms component ID from step 2.

```
var NUMBER_OF_MINUTES = "60";

TB.render('component_ID', function(data) {
    var durationInput = $(data.ele.find('.my-date-range input')[1]);
    durationInput.val(NUMBER_OF_MINUTES).change();
    durationInput.attr('disabled', 'disabled');
    data.ele.find('select').attr('disabled', 'disabled');
    data.ele.find('button.af-form-submit').on('click', function() {
        setTimeout(function() {
            durationInput.val(NUMBER_OF_MINUTES).change();
        }, 500);
    });
});
```

![Screenshot for “Pre Populate & Disable Date Range”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-10/scaled-1680-/image-1665354998858.png)

**Original Community Post:**

[Pre populate & disable fields via JavaScript tab - Community Discussions / How Do I - Tadabase Community](https://community.tadabase.io/t/pre-populate-disable-fields-via-javascript-tab/1456/2)
