aasker Posted February 3, 2015 Report Share Posted February 3, 2015 Trying to do a single record update with the script below...but it does not seem to be updating...not sure whats wrong <SCRIPT LANGUAGE="JavaScript"> function update() { var Quantity = document.getElementById("cbParamVirtual1").value; var Serving = document.getElementById("EditRecordNewDivvyMeal_Servings").value; var newqty = Serving - Quantity; document.getElementById("EditRecordNewDivvyMeal_Servings").value = newqty; } document.getElementById("caspioform").onsubmit=update; if(document.getElementById("caspioform")) { document.getElementById("caspioform").style.display = 'none'; setTimeout('document.forms["caspioform"].submit()',100); } </SCRIPT> Quote Link to comment Share on other sites More sharing options...
LWSChad Posted February 3, 2015 Report Share Posted February 3, 2015 I don't know for sure, but it could be that your timeout is too short. I have tried to shorten up the timeout time on my auto-submitted pages and it often submits before the data can be completely updated. <SCRIPT LANGUAGE="JavaScript">function update(){var Quantity = document.getElementById("cbParamVirtual1").value;var Serving = document.getElementById("EditRecordNewDivvyMeal_Servings").value;var newqty = Serving - Quantity;document.getElementById("EditRecordNewDivvyMeal_Servings").value = newqty;}document.getElementById("caspioform").onsubmit=update;if(document.getElementById("caspioform")) {document.getElementById("caspioform").style.display = 'none';setTimeout('document.forms["caspioform"].submit()',1000); }</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.