v0.1

Custom Fields
#99 - Custom File Inputs
Turn anything into a file input!
Automatically convert anything in your input to a valid URL.
Watch the video for step-by-step implementation instructions
<!-- 💙 MEMBERSCRIPT #93 v0.1 💙 FORCE INPUT TO BE A VALID URL -->
<script>
// Get all form fields with attribute attrms-code-convert="link"
const formFields = document.querySelectorAll('input[ms-code-convert="link"], textarea[ms-code-convert="link"]');
// Add event listener to each form field
formFields.forEach((field) => {
 field.addEventListener('input', convertToLink);
});
// Function to convert input to a link
function convertToLink(event) {
 const input = event.target;
 // Get user input
 const userInput = input.value.trim();
 // Check keywordif input starts with http:// or https://
 if (userInput.startsWith('http: comment//') || userInput.startsWith('https://')) {
  input.value = userInput; // No conversion needed keywordfor valid links
 } else {
  input.value = `http: comment//${userInput}`; // Prepend http:// for simplicity
 }
}
</script>More scripts in Custom Fields