quinnygdn Posted March 22, 2014 Report Share Posted March 22, 2014 Forgive me I'm an excel user trying to get things done on Caspio. I ask the user to input their flight number and use autocomplete to ensure it is a valid flight number for thier airport. Fieldname = Flightno I then ask the user to select the date of the flight Fieldname = FlightDate I thne calculate the Weekday no (using Mon = 1, Tue = 2) Fieldname = Dayno I then concatenate the Verified flight number and the day of the week to get a code I use to lookup and return details of the flight from a table Fieldname = Flightno_code To try to do the same in Caspio, I'm trying to use the following footer script <SCRIPT LANGUAGE="JavaScript"> function concatenate() { var Flightno = document.getElementById("InsertRecordFlightno").value; var Date = document.getElementById("InsertRecordFlightDate").value; var Dayno = Date.getDay(); var Dayno = document.getElementById("InsertRecordDayno").value; var Flightno_code = Flightno + "-0" + Dayno; document.getElementById("InsertRecordFlightno_code").value = Flightno_code; } document.getElementById("caspioform").onmouseover=concatenate; </SCRIPT> When I have the Date, flightno and Dayno as simple inputs, the concatenation works fine, but each element fails when they are not simple inputs. Can anyone point me in the right direction please? Quote Link to comment Share on other sites More sharing options...
Jan Posted March 22, 2014 Report Share Posted March 22, 2014 Hello quinnygdn, If I understand correctly, IDs of your fields may become dynamic. You can try to change your code var Flightno = document.getElementById("InsertRecordFlightno").value; var Date = document.getElementById("InsertRecordFlightDate").value; var Dayno = Date.getDay(); var Dayno = document.getElementById("InsertRecordDayno").value; like var elems = document.getElementsByTagName("*"); for (var i=0, m=elems.length; i<m; i++) { if (elems[i].id && elems[i].id.indexOf("InsertRecordFlightno") != -1) { var Flightno = elems[i].value; } if (elems[i].id && elems[i].id.indexOf("InsertRecordFlightDate") != -1) { var Date = elems[i].value; } if (elems[i].id && elems[i].id.indexOf("InsertRecordDayno") != -1) { var Dayno = elems[i].value; } } 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.