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
Originally posted by rchampagneca March 15, 2023
Tried to use the CrudField JavaScript Library calls to get and set dates for a Bootstrap Date Picker (Backpack pro). Is it supported ? Tried this script as a workaround :
functionsetDateForInputField(variableName,monthsToAdd){varelement=document.querySelector(`[bp-field-name="${variableName}"]`);varformattedtoValue=null;if(monthsToAdd!==null){varcurrentDate=newDate();vartoValue=newDate(currentDate.setMonth(currentDate.getMonth()+monthsToAdd));varformattedtoValue=toValue.toISOString().slice(0,10);}varinputField=element.querySelector('input[bp-field-main-input]');vardateField=element.querySelector('input[data-bs-datepicker]');$(dateField).datepicker('setDate',toValue);// Order of the next 2 methods seems important !$(inputField).attr("value",formattedtoValue);}
Does the job.
The text was updated successfully, but these errors were encountered:
pxpm
transferred this issue from Laravel-Backpack/community-forum
Mar 31, 2023
I totally agree we should do this at some point... but it's A LOT of work to do this for all field types... so let's postpone this. Until then, developers who need to do this can find individual solutions for their use cases.
Discussed in Laravel-Backpack/community-forum#436
Originally posted by rchampagneca March 15, 2023
Tried to use the CrudField JavaScript Library calls to get and set dates for a Bootstrap Date Picker (Backpack pro). Is it supported ? Tried this script as a workaround :
Does the job.
The text was updated successfully, but these errors were encountered: