We help IT Professionals succeed at work.
Get Started

Javascript with ColdFusion form using OnClick

lonnyo
lonnyo asked
on
926 Views
Last Modified: 2012-05-12
I have a form that is used in a Content Management System to update a webpage.  The first button is a preview button, so the user can see what the page looks like before submitting it to the database. The second button submits the form information to the database so the changes are live on the site.

On submission of the update button, I want to present a message that warns the user it will permanently update the website and cannot be undone.

I want an pop up box to appear with the option to continue or cancel. I have done this before, but not combined with other actions within an OnClick event.

Here is the code I have right now:

 
<cfform class="clear-both" name="formUpdatePreviewContent" action="../#ActionFile#?CategoryID=#CategoryID#&ParentID=#ParentID#" method="post">
    <label for="Content">
    <cftextarea richtext="true" toolbar="Default" basepath="FCKEditor" name="Content" width="735" height="400">#Content#</cftextarea>
    </label>
    <cfinput type="hidden" name="ContentID" id="ContentID" value="#ContentID#">
    <cfif IsDefined("getContentByCategoryID.ContentID")>
        <cfinput type="hidden" name="ArchiveContentID" value="#getContentByCategoryID.ContentID#">
        <cfinput type="hidden" name="Label" value="#getContentByCategoryID.Label#">
        <cfinput type="hidden" name="DeleteSEOID" value="#getContentByCategoryID.SEOID#">
    </cfif>
    <cfif IsDefined("Form.CurrentCategoryID")>
        <cfinput type="hidden" name="CurrentCategoryID" value="#Form.CurrentCategoryID#">
    </cfif>
    <p>&nbsp;</p>
    <p class="center"><cfinput style="font-size:24px; width:200px;" type="submit" name="Preview" onclick="this.form.target='_blank';return true;" value="Preview"></p>
    <p class="center"><cfinput cfinput style="font-size:12px;" type="submit" name="SubmitPageUpdate" onclick="formUpdatePreviewContent.action='edit_content.cfm'; formUpdatePreviewContent.target='_self';  return true;" value="Submit Page Update"></p>
</cfform>

Open in new window


Thanks for the help.
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE