Zergman Posted April 3, 2010 Share Posted April 3, 2010 I'm making a simple page by request from my boss. The page has 1 textarea. What he wants is when he types something in the textarea for it to save when the page looses focus. .... kinda like an auto save function. I've been trying to do this using a simple form and submitting it via javascript but its not saving to the database. <script type="text/javascript"> function submitform() { document.form1.submit(); } </script> <form method="post" name="form1" id="form1" action="entry.php"> <textarea name="data_entry" id="data_entry" class="textareastyle" cols="150" rows="24" onblur="submitform();"><?php echo KT_escapeAttribute($row_rsePad['data']); ?></textarea> <input type="hidden" name="tdate" id="tdate" value="<?php echo(date('Y-m-d'))?>" /> <input type="hidden" name="ttime" id="ttime" value="<?php echo(date('H:i:s'))?>" /> </form> The form submits, but its not being written to the database. Kinda like the page is just being refreshed. If I add a submit button, it works but only if the button is clicked. Suggestions? Quote Link to comment Share on other sites More sharing options...
DavidAM Posted April 3, 2010 Share Posted April 3, 2010 Sounds like it might be a problem in entry.php. Post that code and let's take a look Quote Link to comment Share on other sites More sharing options...
Zergman Posted April 3, 2010 Author Share Posted April 3, 2010 actually its on the same page as the form. Trying to keep this as simple as possible lol. $upd_ePad = new tNG_update($conn_cnepix); $tNGs->addTransaction($upd_ePad); $upd_ePad->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Update1"); $upd_ePad->setTable("Pad_data"); $upd_ePad->addColumn("tdate", "DATE_TYPE", "POST", "tdate"); $upd_ePad->addColumn("ttime", "DATE_TYPE", "POST", "ttime"); $upd_ePad->addColumn("data", "STRING_TYPE", "POST", "data_entry"); $upd_ePad->setPrimaryKey("user_name", "STRING_TYPE", "SESSION", "logged_in_user"); $tNGs->executeTransactions(); $rsePad = $tNGs->getRecordset("Pad_data"); $row_rsePad = mysql_fetch_assoc($rsePad); $totalRows_rsePad = mysql_num_rows($rsePad); 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.