jsingerforusaenergy Posted February 27, 2010 Report Share Posted February 27, 2010 Hi, I'm trying to set up a system to use 3 different checkboxes to each assign a value to a specific field from a details page. I could use a dropdown to achieve the effect I'm looking for but I'm new to javascript and databasing and am using this as a practice test to move on to bigger and better things. The code I'm using looks like this: function confirmation() { if(document.getElementById(\"InsertRecordBIZ_appointments_Appointment_Confirmation\").checked) { document.getElementByID(\"InsertBIZ_appointments_Appointment_Status\").value=\"Confirmed\"; } else if(document.getElementById(\"InsertRecordBIZ_appointments_Appointment_cancelReschedule\").checked) { document.getElementById(\"InsertRecordBIZ_appointments_Appointment_Status\").value=\"Reschedule\"; } else if(document.getElementById(\"InsertRecordBIZ_appointments_Appointment_cancelEnd\").checked) { document.getElementById(\"InsertRecordBIZ_appointments_Appointment_Status\").value=\"End\"; } else { document.getElementbyId(\"InsertRecordBIZ_appointments_Appointment_Status\").value=\"\"; } } document.getElementByID(\"3_appointments_action_confirmation\").onsubmit=confirmation; any help on where I'm going wrong would be greatly appreciated. -jsinger Quote Link to comment Share on other sites More sharing options...
sbelini Posted March 1, 2010 Report Share Posted March 1, 2010 Hi, You mention you are working on a Details page. If so, try using "EditRecordFIELDNAME" instead of "InsertRecordFIELDNAME" Quote Link to comment Share on other sites More sharing options...
jsingerforusaenergy Posted March 2, 2010 Author Report Share Posted March 2, 2010 I'll try that thanks a ton! EDIT: Well, I changed the references to EditRecord, unfortunately that didn't fix the solution. the script currently looks like this function confirmation() var confirm = document.getElementById(\"EditRecordBIZ_appointments_Appointment_Confirmation\").value; { if (confirm == yes) { document.getElementByID(\"EditRecordBIZ_appointments_Appointment_Status\").value=\"Confirmed\"; } } document.getElementByID(\"caspioform\").onsubmit=confirmation; Quote Link to comment Share on other sites More sharing options...
h8windows Posted March 16, 2010 Report Share Posted March 16, 2010 I think your syntax may be screwing it up. try: <SCRIPT LANGUAGE="JavaScript"> function confirmation() var confirm = document.getElementById("EditRecordBIZ_appointments_Appointment_Confirmation").value; { if (confirm == "yes") { document.getElementByID("EditRecordBIZ_appointments_Appointment_Status").value="Confirmed"; } } document.getElementByID("caspioform").onsubmit=confirmation; </SCRIPT> The backslash is used to escape quotes, so it was probably choking there. Also, by NOT having quotes around yes, javascript assumes that yes is a variable, which in your case it is not. 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.