Jump to content

Submit Update Form Using onblur


Zergman

Recommended Posts

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?

Link to comment
Share on other sites

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);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.