You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recent changes to torch.js broke how it disables form inputs. I fixed it manually on one of our projects, and here's the updated code that works:
importPikadayfrom'pikaday'window.onload=()=>{constslice=Array.prototype.slice/* * Prevent empty fields from being submitted, since this breaks Filtrex. */constformFilters=document.querySelector('form#filters')if(!formFilters)returnformFilters.addEventListener('submit',function(e){e.preventDefault()letcanSubmit=trueslice.call(this.querySelectorAll('.field'),0).forEach((field)=>{lettext=field.getElementsByTagName('label')[0].textContentletstart=field.getElementsByClassName('start')[0]letend=field.getElementsByClassName('end')[0]if(start&&end){if(start.value===''&&end.value!==''){window.alert(`Please select a start date for the ${text} field`)canSubmit=false}elseif(end.value===''&&start.value!==''){window.alert(`Please select a end at date for the ${text} field`)canSubmit=false}}})if(canSubmit){slice.call(this.querySelectorAll('input, select'),0).forEach((field)=>{if(field.value===''){field.disabled=true}})e.target.submit()}})slice.call(document.querySelectorAll('select.filter-type'),0).forEach((field)=>{field.addEventListener('change',(e)=>{e.target.nextElementSibling.name=e.target.value})})slice.call(document.querySelectorAll('.datepicker'),0).forEach((field)=>{newPikaday({field: field})})}
The text was updated successfully, but these errors were encountered:
Recent changes to
torch.js
broke how it disables form inputs. I fixed it manually on one of our projects, and here's the updated code that works:The text was updated successfully, but these errors were encountered: