close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Update Form On Page Load

Thread began 6/18/2014 2:07 pm by bill173836 | Last modified 6/18/2014 3:18 pm by Jason Byrnes | 654 views | 3 replies |

bill173836

Update Form On Page Load

I have a page that I need to submit a form on that already prints the page. I have a print on load script in place <body onload="printpage()"> and I also have a form where I want to update data in the database. The page prints and then redirects with the proper parameters but the form doesn't do anything. How can I make the form submit also? Thanks

Attached Files
print-coupon.php
Sign in to reply to this post

Jason ByrnesWebAssist

you would need to add a command to the printpage() funciton to submit the form.

see this page for an example of how to submit a form using javascript:
http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml

Sign in to reply to this post

bill173836

So something like this?

<form id="UpdateCreditsForm" name="UpdateCreditsForm" method="post" action="">
<input name="DetailID" type="hidden" id="DetailID" value="<?php echo $_GET['book'] ?>" />
<input name="NewCreditTotal" type="hidden" id="NewCreditTotal" value="<?php echo $_GET['credits'] ?>" />
</form>
<script type="text/javascript">
function submitform()
{
if(document.UpdateCreditsForm.onsubmit &&
!document.UpdateCreditsForm.onsubmit())
{
return;
}
document.UpdateCreditsForm.submit();
}
window.print();
window.location.href = "campaign-coupons.php?campaign=<?php echo $_GET['campaign'] ?>&book=<?php echo $_GET['book'] ?>";
</script>

This did print the page and redirect but completely ignored the form.

Sign in to reply to this post

Jason ByrnesWebAssist

I would think it should print before the form submit.

To be honest, I cant really help in the exact syntax needed, We could help implement this in a premiere support appointment if you need help with creating the code.

http://www.webassist.com/premier_request.php

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...