CoopperBackpack Posted May 11, 2020 Report Share Posted May 11, 2020 Hello, I have found this solution https://stackoverflow.com/questions/35942247/how-to-move-placeholder-to-top-on-focus-and-while-typing How can I implement it on Caspio? Thanks Quote Link to comment Share on other sites More sharing options...
Hastur Posted May 11, 2020 Report Share Posted May 11, 2020 Hello @CoopperBackpack You can insert this snippet of code into your submission form Header: <style> .cbFormFieldCell { position: relative; width: 50%; } .cbFormFieldCell .floating-label { position: absolute; color: gray; font-size: 13px; pointer-events: none; top: 11px; left: 20px; transition: 0.2s ease all; } .cbFormFieldCell input:focus ~ .floating-label, .cbFormFieldCell input:not(:focus):valid ~ .floating-label { top: 0px; left: 10px; font-size: 10px; opacity: 1; background-color: white; padding: 0 3px; } </style> <script> document.addEventListener("DataPageReady", placeholderHandler); function placeholderHandler() { const labels = document.querySelectorAll('.cbFormLabelCell'); const inputs = document.querySelectorAll('.cbFormFieldCell'); for(let i = 0; i < labels.length; i++) { if (inputs[i].children[0].type === 'text') { labels[i].children[0].classList.add("floating-label"); inputs[i].children[0].setAttribute("required", true); inputs[i].appendChild(labels[i].children[0]); labels[i].remove(); } } console.log(labels); } </script> You also can customize the placeholder adjusting the properties in the style tag of the code. CoopperBackpack 1 Quote Link to comment Share on other sites More sharing options...
CoopperBackpack Posted May 11, 2020 Author Report Share Posted May 11, 2020 Thank you, @Hastur This solution works. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.