esisov Posted November 2, 2015 Report Share Posted November 2, 2015 Hi, i have several input fields (Date/time) for user to need to insert their birth date. As the popup calendar it is a little bit uncomfortable to go many years ago, some of them wants to insert the dates manually, so i need to create a mask with predefine dd/mm/yyyy format to able the users to just insert the numbers and then the field could have the right format to can be inserted. Any idea? Thanks! Quote Link to comment Share on other sites More sharing options...
iren Posted November 2, 2015 Report Share Posted November 2, 2015 Hello esisov, You can add this code to the Footer (do not forget clicking the Source button and changing FIELDNAME to the name of your field): <SCRIPT LANGUAGE="JavaScript">function f_a(v_id) { return document.getElementById(v_id); } f_a('InsertRecordFIELDNAME').maxLength = 10; f_a('InsertRecordFIELDNAME').onkeyup = function(v_e) { v_e = v_e || window.event; if (v_e.keyCode >= 65 && v_e.keyCode <= 90){ this.value = this.value.substr(0, this.value.length - 1); return false; }else if (v_e.keyCode >= 37 && v_e.keyCode <= 40){ return true; } var v_value =(this.value.replace(/[^\d]/g, '')); if (v_value.length==8) { this.value = (v_value.substring(0,2) + "/" + v_value.substring(2,4) + "/" + v_value.substring(4,8));} } </SCRIPT> Hope it helps. IREN esisov 1 Quote Link to comment Share on other sites More sharing options...
esisov Posted November 2, 2015 Author Report Share Posted November 2, 2015 Thank you, Iren. It works!! Quote Link to comment Share on other sites More sharing options...
sSchnitzl Posted August 17, 2016 Report Share Posted August 17, 2016 Hello Community! As absolutely newbie in Caspio (as well as in programming anything....) I´ve tried to solve the same problem, as the TO has had, on my page as well with this solution, but it doesn´t work!? Please see screenshots I´ve made:http://prntscr.com/c6u4s0 http://prntscr.com/c6u5md Any ideas or suggestions? Thanks in advance for your reply! Quote Link to comment Share on other sites More sharing options...
Mathilda Posted August 18, 2016 Report Share Posted August 18, 2016 Hi, As far as I can see you didn't select the Source tab before inserting code in the html editor: http://howto.caspio.com/faq/caspio-bridge-8-4/inserting-code-in-html-blocks-and-header-footer/ You should select code->cut->select "Source" tab-> insert code. Hope it helps sSchnitzl 1 Quote Link to comment Share on other sites More sharing options...
sSchnitzl Posted August 18, 2016 Report Share Posted August 18, 2016 @Mathilda: Thank you very much for your reply - you was right with my fault in handling it. It´s working now! Quote Link to comment Share on other sites More sharing options...
Mathilda Posted August 18, 2016 Report Share Posted August 18, 2016 You are welcome! I'm glad that it helped! Quote Link to comment Share on other sites More sharing options...
sSchnitzl Posted August 19, 2016 Report Share Posted August 19, 2016 I would like to tell additional a small issue with the date in German usage (where date form is usual "DD.MM.YYYY"): In the above mentioned scrip troubles the "/" a little bit while entering a date and I´ve changed the script as shown below:<SCRIPT LANGUAGE="JavaScript">function f_a(v_id) { return document.getElementById(v_id); } f_a('InsertRecordbesteller_geburtsdatum').maxLength = 10; f_a('InsertRecordbesteller_geburtsdatum').onkeyup = function(v_e) { v_e = v_e || window.event; if (v_e.keyCode >= 65 && v_e.keyCode <= 90){ this.value = this.value.substr(0, this.value.length - 1); return false; }else if (v_e.keyCode >= 37 && v_e.keyCode <= 40){ return true; } var v_value =(this.value.replace(.[^\d]/g, '')); if (v_value.length==8) { this.value = (v_value.substring(0,2) + "." + v_value.substring(2,4) + "." + v_value.substring(4,8));} } </SCRIPT> 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.