TimSpiech Posted January 20, 2014 Report Share Posted January 20, 2014 I have a weight scale that outputs data like a keyboard, however, it outputs a 20 character string, and i only want to use characters 4 through 13, is there a way i can isolate just these characters in a number field?? Example: Scale output: "w:+ 50.000lb "What i want to save in a number field "50.000" please let me know what i need to do. Quote Link to comment Share on other sites More sharing options...
NarayanJr Posted January 21, 2014 Report Share Posted January 21, 2014 Java script can easily handle changing the field as needed. Here is an example, Place that in your footer, or at least that is where I use it. This is assuming it is a Submission form. If it is an update form change InsertRecord with EditRecord. This is also assuming your field is called "Weight". But you can easily change those to match what your fields are called. Note I have not run this so their may be some syntax errors but I believe it is all correct. <script> function modify() { //Find elemeny by name as Caspio likes to assign ids that change. Store the value in the field to weight. var weight = document.getElementsByName("InsertRecordWeight")[0].value; //Take a substring of weight and store it back into weight. weight = weight.substring(4,13); //Set the value of the weight field in the form to the new substring document.getElementsByName("InsertRecordWeight")[0].value = weight; //the new value in the field is what is submitted. } //When the form is submitted called method modify. document.getElementById("caspioform").onsubmit=modify; </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.