Hello @ralfnator
Thank you very much for using our plugin. The date control in WCF7 includes the attributes:
min, max, step, id, class, and placeholder
And it is based on the HTML5 date input tags.
https://contactform7.com/date-field/
So, you can modify only these attributes with the information received from the JSON structure.
I’ll try to describe the process with an example. Assuming you have the JSON object:
[{date:'2022-05-22', min:'2022-05-20', max:'2022-05-25'}]
I’ll use the following URL for demo:
https://resources.developers4web.com/cf7/temp/05/23/db.json
Assign the value is very simple:
[date date]
[cf7-recordset id="data" type="json" url="https://resources.developers4web.com/cf7/temp/05/23/db.json"]
[cf7-link-field recordset="data" field="date" value="date"]
However, defining the min and max attributes is more complex because it requires the use of plugin events:
[date date]
[cf7-recordset id="data" type="json" url="https://resources.developers4web.com/cf7/temp/05/23/db.json"]
[cf7-link-field recordset="data" field="date" value="date"]
<script>
document.addEventListener('cf7-recordset', function(evt){
if(evt.detail['recordset-id'] == 'data')
{
jQuery('[name="date"]').attr('min',evt.detail['recordset-data'][0]['min']).attr('max', evt.detail['recordset-data'][0]['max']);
}
});
</script>
https://cf7-datasource.dwbooster.com/documentation#javascript-events
Best regards.