Clear Form Button

How can I write a code to clear the form once you click the button?

How can I write a code to clear the form once you click the button?
You mean to remove all the controls from the form?
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.Controls.Clear()
End Sub
End Class
Don't forget to vote for Helpful Posts and
Mark Answers!
*This post does not reflect the opinion of Microsoft, or its employees.

Similar Messages

  • Clear Form button on Acrobat Reader

    Just wanted to find out if there has been an update for the Acrobat Reader latest version for the IPAD for a Form that opens on Your IPAD. Your Submit button works, but the Clear Form button will not work on an IPAD. Are you able to tell me when this might be done for the IPAD. It is a crucial button needed on Forms that are opened on an IPAD.

    Here's a recent discussion about this, with some input by someone from Adobe: http://forums.adobe.com/thread/1356621

  • In Acrobat, I wrote a script to turn fields gray if a checkbox was checked. How can I get it to reset to white (or clear) when the reset form button is clicked?

    In Acrobat, I wrote a script to turn fields gray if a checkbox was checked. How can I get it to reset to white (or clear) when the reset form button is clicked?

    Thank you so much for your reply . . . but . . . I should have shared my original script with you -- it was a little more complicated than I led you to believer. I was triggering a group of text fields to become disabled as well as gray. Below is the original script so that when the checkbox is checked, it causes several "Co" fields to be disabled and gray.
    // Mouse Up script for check box 
    // If checked, certain fields should be disabled 
    var f_prefix = "Co"; 
    // Get a reference to all of the "Co" fields 
    var f = getField(f_prefix); 
    // Reset the Co fields 
    resetForm([f_prefix]); 
    if (event.target.value === "Off") { 
        // Enable the Co fields 
        f.readonly = false; 
        f.fillColor = color.transparent; 
    } else { 
        // Disable the Co fields 
        f.readonly = true; 
        f.fillColor = color.gray; 
    To recap -- my goal is to get those gray fields to revert to transparent if the form is reset. I'm willing to create my own custom "Reset Form" button but I'm not sure I understand how that would look. Wouldn't it be quite lengthy? I think I'm having a brain freeze -- can't figure it out!

  • "Display Form" button not visible in UWL preview

    Hi Friends,
    We are implementing Travel module. The standard Workflow WS20000050 has a single level of approval. However, we wanted 2 level approval and so accordingly this was implemened.
    Now we want a 3rd level of decision step to be approved by the traveldesk on recept of tickets.
    Even the pdf form, which contains the travel details, needs to be visible. In the standard task TS20000118, the "Display Form" button is automatically visible in the UWL preview apart from the usual 
    "Approve" and "Reject" buttons.
    However the content that needs to be shown to the traveldesk is different. To achieve this, i copied the standard task TS20000118 and changed only the task description. Rest everything including the parameters and binding remains same.
    But for this task, the "Display Form" button is not visible.
    1. Please advice on the possible reasons why this is happening ?
    2. Is there any setting or any SPRO configuration wherin we need to 
        specify the tasks for whom the button needs to be displayed ?? or
        Is it some portal side configuration ?
    Thanks,
    Shashank

    Hi Vijay,
    Goto:
    Universal Worklist Content Configuration -> Click to Administrate Item Types and View Definitions
    In the table under the "Current Configurations" tab, select the standard travel configuration provided by SAP -> "com.sap.pct.erp.mss.tra".
    Here, search for the code of the task for which everything is working fine; in our case it was TS20000118. Copy this piece of code.
    Now download the currently active XML configuration. In the saved XML file, search for the task code which is not working as expected. Replace this piece of code with the code copied in the above step. Save with a different name.
    Upload this new configuration with HIgh priority.
    Reregister the connector and clear the cache.
    These steps solved my problem. Probably it should work for you too.
    Regards,
    Shashank

  • Protect Form Fields from "Clear Form"

    I've created PDF Form with various fields, and created button to make readonly for all the Field data. This PDF Form will be used by 3 persons in different section. How to protect all filled text fields from "Clear Form" function in Form Tool.
    Once the Form fields are filled by 1 person, the other person can not use the "Clear Form" function to clear all filled fields. Please guide to to protect filled text,checklist fields from "Clear Form".

    If one flattens the form fields then they become context and are no longer form fields. It is possible to selectively flatten PDF content like annotations, form fields, page ranges, and by the "print/no print" property for Acrobat versions 6 or above.
    The flattenPages is not available to Reader.
    PDFScripting.com has a tool bar button that can perform selective flattening.

  • Clear page button- yes and cancel?

    Hi all, I'm just learning javascript and could use some help.  I have an Acrobat PDF form with a clear page button on the top.  When the user clicks the button, I would like an alert to popup that says "Are you sure you wish to clear the page?".  If the user clicks "Yes", the page clears.  If the user clicks "No", the alert disappears and nothing else happens.  I don't know how to get the cancel button to work, but everything else works fine.  Here's my code:
    var clearbutton = app.alert({
    cMsg: "Are you sure you wish to clear the page?",
    cTitle: "Clear Page?",
    nIcon: 2, nType: 1
    var iPage = pageNum;
    var sFields = new Array();
    for(var x=0;x<numFields;x++)
    {var pg = getField(getNthFieldName(x)).page;
    if((typeof pg == 'number' && pg == iPage) || (typeof pg != 'number' && pg.indexOf(iPage) > -1))sFields[sFields.length] = getNthFieldName(x);}
    if(sFields.length > 0)resetForm(sFields);
    How do I associate the cancel button (return of 2) with not continuing with the rest of the script? Thanks to anyone who can help out!!

    Try;
    function ClearPage() {
    var clearbutton = app.alert({
    cMsg: "Are you sure you wish to clear the page?",
    cTitle: "Clear Page?",
    nIcon: 2, nType: 1});
    if (clearbutton == 1) {
       // "OK" selected
       var iPage = this.pageNum;
       var sFields = new Array();
       var pg;
       // loop through all fields and find fields on page
       for(var x=0; x < numFields; x++){
          pg = this.getField(getNthFieldName(x)).page;
          if((typeof pg == 'number' && pg == iPage) || (typeof pg != 'number' && pg.indexOf(iPage) > -1))
             sFields[sFields.length] = getNthFieldName(x); // fill array of field names
       } // end for loop numFields
       // clear the field names
       this.resetForm(sFields);
    } // end if 'OK"
    // if anything other than "OK" nothing done
    return;
    } // end ClearPage funciton
    // call the ClearPage function
    ClearPage();

  • Question:   how to resize form buttons in a CSS

    I have a question.   I am trying to implement some PayPal features into my website with some their custom button functionality.   In normal HTML, the buttons look fine.  But using a CSS template, the form buttons get squashed and funny looking.   Is there an easy way to resize them?
    (I'm using Dreamweaver CS4 on a WinVista machine)  
    Any help is greatly appreciated. 
    -ryan

    and here is the ENTIRE CSS file
    CSS Credit: http://www.templatemo.com/
    body {
        margin:0;
        padding:0;
        line-height: 1.5em;
        font-family:  Helvetica, Arial, sans-serif;
        font-size: 11px;
        color: #FFFFFF;
        background: #FFFFFF;
    h1 {
        margin: 0 0 25px 0;
        padding: 10px 0 10px 15px;
        font-size: 20px;
        font-weight: bold;
        color: #ffc601;
        background: #000000;
        border-bottom: 1px solid #b4a08a;
    h2 {
        width: 235px;
        height: 25px;
        padding: 15px 0 0 35px;
        margin: 0 0 25px -10px;
        font-size: 16px;
        color: #6c5b4c;
        background: url(images/left_heading_background.gif) no-repeat;
    h3 {
        margin: 0 0 5px 0;
        padding: 0;
        font-weight: bold;
        font-size: 14px;
        color: #ffc601;   
    h4 {
        margin: 0 0 5px 0;
        padding: 0;
        font-weight: bold;
        font-size: 12px;
        color: #999999;
        text-align: center;
    .rantsection {
        height: 13px;
        margin-bottom: 10px;
    .rantsection img {
        float: left;
        height: 13px;
        width: 13px;
        border: 0px;
        margin-right: 5px;
    a:link, a:visited { color: #999999; text-decoration: none;}
    a:active, a:hover { color: #999999; text-decoration: underline;}
    .more_button a{
        clear: both;
        text-align: center;
        display: block;
        width: 60px;
        padding: 1px 0;
        margin-bottom: 5px;
        background: #6c5b4c;
        border-bottom: 1px solid #a59180;
        color: #FFFFFF;
        font-weight: bold;
        text-decoration: none;
    .download_button a{
        float: right;
        text-align: center;
        width: 65px;
        padding: 1px 0;
        background: #6c5b4c;
        border-bottom: 1px solid #a59180;
        color: #FFFFFF;
        font-weight: bold;
        text-decoration: none;
    img {
        border: 1px solid #6c5b4c;
    /* ----- Form ----- */
    .form_row{
        margin-bottom: 3px;
    form{
        margin: 0;
        padding: 0;
        text-align: right;   
    label {
        margin-right: 10px;
    input{
        width: 130px;
        height: 18px;
        padding: 1px 0;
        line-height: normal;
        color: #99836c;
        border: 1px solid #99836c;
        background: #400a0a;
        font-size: 14px;
    select{
        color: #99836c;
    .button{
        width: 60px;
        line-height: normal;
        margin: 0;
        height: 23px;
    /* End of Form */
    #container {
        margin: 0px auto;
        width: 970px;
        background: url(images/main_background.gif) repeat-y;
    /*------------ Header --------------- */
    #header {
        float: left;
        width: 900px;
        padding: 0 35px;
        margin: 15px 0 10px 0;
    #title {
        float: left;
        width: 300px;
    #sitetitle {
        padding: 30px 0 10px 0;
        font-size: 4.0em;
        font-weight: bold;
        color: #FF9933;
    #sitetitle span{
        font-weight: normal;
        color: #FFFFFF;
    #login {
        float: right;
        margin-top: 25px;
        width: 300px;
    /* -------------- End of Header------------------ */
    /* --------- Banner ---------- */
    #banner {
        clear: both;
        width: 970px;
        height: 256px;
        background: url(images/banner.jpg) no-repeat;
    #banner_text {
        padding: 60px 0 0 225px;
        width: 550px;
    #banner_title{
        margin: 0 0 25px 0;
        padding: 0;
        font-size: 24px;
        font-weight: bold;
        color: #ffc601;
    #banner_text p{
        margin: 0 0 25px 0;
        padding: 0;
    /* --------- End of Banner ---------- */
    /*--- Menu ---*/
    #menu{
        float: left;
        width: 970px;
        height: 51px;
        background: url(images/menu_background.gif) no-repeat;
    #menu ul {
        float: left;
        margin: 0;
        padding: 10px 0 0 40px;
        list-style: none;
    #menu ul li{
        display: inline;
    #menu ul li a{
        float: left;
        width: 140px;
        height: 20px;
        margin-top: 10px;
        padding: 0;
        font-size: 1.1em;
        font-weight: bold;
        text-align: center;
        text-decoration: none;
        color: #CCCCCC;
        border-right: 1px solid #CCCCCC;
    #menu ul li .lastmenu{
        border-right: none;
    #menu li a:hover, #menu li .current{
        color: #FFCC33;
    /*--- End of Menu ---*/
    /*--- Content ---*/
    #content {
        float: left;
        margin: 0;
        padding: 0 10px;
        width: 950px;
        color: #FC3;
        text-align: center;
    /*--- Left Column---*/
    #left_column {
        float: left;
        margin: 20px 10px 0 0;
        padding: 0px;
        width: 235px;
    .left_col_box {
        margin: 0 0 25px 25px;
        color: #AAA;   
    .blog_box {
        padding-bottom: 15px;
        margin-bottom: 15px;
        border-bottom: 1px solid #220404;
    .blog_box h3 a{
        font-size: 12px;
        color: #d3a401;   
    .blog_box span{
        color: #99836c;
    /*--- End of Left Column---*/
    /*--- Right Column---*/
    #right_column {
        float: right;
        margin: 25px 25px 0 0;
        padding: 0;
        width: 650px;
    .right_panel_fullwidth {
        float: left;
        width: 650px;
        padding: 0 0 25px 0;
    .right_panel_fullwidth img{
        float: left;
        margin: 3px 10px 0 0;
    .right_panel_fullwidth_content {
        float: left;
        width: 620px;
        padding: 0 15px 25px 15px;
    .right_panel_fullwidth_content p{
        text-align: justify;
    #new_released_section {
        float: left;
        width: 650px;
        margin: 0 0 30px 0;
    .new_released_box {
        float: left;
        width: 180px;
        margin: 0 10px 0 15px;
        text-align: center;
    .new_released_box img{
        margin-bottom: 5px;
    #news_section {
        float: left;
        width: 310px;
        margin: 0 25px 0 0;
    .news_box {
        float: left;
        width: 280px;
        margin: 0 15px 25px 15px;
    .news_box img{
        float: left;
        width: 110px;
        margin: 3px 10px 0 0;
        border: 1px solid #333333;
    .news_box p{
        margin: 0;
        padding: 0;
    #topdownload_section {
        float: right;
        width: 300px;
        padding: 0;
        margin: 0;
        background: #99836c;
    .topdownload_box {
        float: left;
        width: 270px;
        padding-bottom: 5px;
        margin: 0 15px 10px 15px;
        color: #24211d;
        font-weight: bold;
        border-bottom: 1px solid #6b5946;
    * html .topdownload_box {
        margin: 0 15px 10px 7px;
    .topdownload_box span{
        font-weight: normal;
    .title_singer{
        float: left;
        width: 200px;
    /*--- End of Right Column---*/
    /*--- End of Content ---*/
    /* ----- Footer ----- */
    #footer {
        clear: both;
        padding: 15px 0;
        width: 950px;
        margin: 0 10px;
        text-align: center;
        color: #000000;
        background: #6c5b4c;
        text-align: center;
    #footer a{
        color: #000000;
    #footer a:hover{
        color: #cccc66;
    /* ----- End of Footer ----- */
    #container #content #right_column #new_released_section .new_released_box h3 {
        text-align: center;

  • How to remove "submit form" button that's generated when distributing form without Designer

    When I open it in Designer to delete the image all of my java gets screwed up, so I'm hoping there is a solution that doesn't involve updating all of the code. I'm using PDF Expert 5 and Box because adobe's reader is absolute garbage.
    Thank you in advance!

    Sorry for not being clear, LC Designer.
    Here is a screenshot of the submit form button in a blank form that's automatically inserted when distributing. If I open it in LC Designer I can remove the submit form button but it screws up all java and formatting. (sorry for not inserting an image or link, adobe'ss forums are about as well developed as its software)
    http://imgur.com/xHZKior

  • Exit / Clear Form & raise form_trigger_failure

    I hope someone has encountered a similar situation and can help me out here.
    I need to provide the functionality of allowing the user to Exit or Clear a form in case there are errors due to item validations.
    The problem I am encountering is that since the item validations have triggered form_trigger_failure, the Exit / Clear buttons that I coded with Exit_form / Clear_form do not work.
    I can have the user use the Exit key to exit, but it would be great if there is some way of providing this functionality using a button.
    Thanks in advance.

    Thileepan,
    Thanks for your suggestions.
    I am already using Clear_Form(No_Validate) and the fields are set to Required = No, validation being done in a when-validate-item trigger.
    I tried suggestion #3, but that results in the validation that takes place as the user leaves a field being lost, which they want(won't accept form level validation).
    Suggestion 4 works for the clear form, but if I don't raise form_trigger_failure in the when-validate-item trigger the validation error message is displayed and focus moves to the next field in case of user input error. What I want is to have the focus stay in the field containing the error and still give the user the ability to Exit/Clear the form in case they get tired of trying to come up with a value that satisfies the validation criteria.
    Thanks.

  • Distribute Form button failing to show dialog box

    Has anyone else had this problem? I click the Distribute Form button and it fails to bring up the Form Distribution Options dialog box.
    This is driving me nuts. Any help is appreciated.
    Jen
    Updating this a bit. Moved the file to another machine and it works but same file not working still on other machine. Any ideas what would stop this dialog box from appearing?

            Hi there ,
           OA Framework has different way to show the dialog page , you can import the dialouge bean
          ( OADialogPage )
           and follow the code mentioned below in your controller class ( PFR ) :
    OADialogPage dialogPage = new OADialogPage(OAException.WARNING,
    mainMessage, null, "", "");
    String yes = pageContext.getMessage("AK", "FWK_TBX_T_YES", null);
    String no = pageContext.getMessage("AK", "FWK_TBX_T_NO", null);
    dialogPage.setOkButtonItemName("DeleteYesButton");
    dialogPage.setOkButtonToPost(true);
    dialogPage.setNoButtonToPost(true);
    dialogPage.setPostToCallingPage(true);
    pageContext.redirectToDialogPage(dialogPage);
    Please let me know if its not clear / if you need any further input .
      Regards ,
      Keerthi

  • Clear form Option resets read only properties

    Hey guys,
                         Using your help I got my problem solved last time. So when I have a series of Questions, I set all questions to read only in their properties except the first Question. Once the first question is answered, using the script below, I then set read only for the next question to false and students can answer the next question now. So using this pattern, it allows them to answer one question after the other without skipping any.
    The Mouse Up action for each "Radio Button1" could be:
    if(event.value != "Off") this.getField('Radio Button2').readonly = false;
    Now, while this works perfectly for time being, I keep experimenting with this form with lots of modifications made as needed. When I use the "clear form" Option to empty all the form fields before saving it, all the read only Questions reset and now when we close and re open the file, any question can be answered and the script used above has no more value.
    What is the script needed here to avoid the read only questions to reset when i use the clear form option. Please help me out here!

    Clear the form menu action or the "this.resetForm();" script only resets the values of the fields.
    You script will one execute when there is a Mouse Up action, and if a radio button or check box is set to read only then there can be no field actions. The field is locked to user interaction and can only be manipulated by JavaScripts.
    There is no trap for the reset or clear action so even if you created a button to reset and clear the form fields with the read only property set, you would still have the issue of the user using the menu option. You can add a document level script to clear the read only property of fields when the form is opened.

  • Clear-form(no_validate)

    I am using Forms 6i. In my form, I have one button called 'Clear'. In when-button-pressed trigger I have written the code as Clear-form(no_validate). Also I have one more field in which i have written some code in the 'when validate item' trigger(I am validating the number entered if it is wrong i am raising raise form_trigger_failure). Now the text field is having some invalid number, I want to clear the form instead of retyping the number. When I press the 'clear button', still the validation code is executed for that field and I am unable to clear the form. Is there any way to solve this problem.
    Thanks in advance
    regards
    Ramakrishnan

    Hi prasad thanks
    it works fine as per your idea. is there any other way to work around it.
    Regards
    Ramakrishnan

  • Clearing Form Problem

    Hi i have a form member form which has a button called SEARCH_MEMBER_LOV_BUTTON. When this is clicked, it displays an LOV of member details.Once a record is selected, the relevant details are then shown in my text fields and radio buttons, these are details such as name, address email etc. I also have button called CLEAR_BUTTON which uses a when button pressed trigger:
    -- This is used to clear the form
    clear_block;
    The buttons are in a datablock called BUTTONS. The problem i am having is that when i click the clear button 1st) it does not clear the fields 2nd) When click the button the focus is sent back to the search button.
    Can sombody tell me why this is happening and how i can resolve this please.
    Please note: i have also used the code clear_form which does the same
    Thanks

    Perhaps the clear_block is clearing the BUTTONS block as the focus will be in there. That will explain why it goes to the search button, as that is probably the 1st navigable item on the block so it goes there after the clear_block call.
    Either GO_BLOCK/GO_ITEM to the data block in the W-B-P trigger, or make it not Mouse Navigate and then the focus will stay on the data block.

  • Place a "reset form" button using livecycle

    I Placed a button on a form called "Clear Form" Now what do I do to reset the form when clicked?  Can I also add a "Are you sure message" with another ok button?

    Thanks for the script. I have a form with radio buttons that make certain fields appear visible/invisible mattering on wheather user chooses yes or no. I used actions to perform the visible/invisible function.
    When using your script i get the Yes/no option in a popup and if I choose yes it correctly clears all my rado buttons and also resets any fields.
    However the no fuction does not seem to be working. If I choose no it still clears out everything, the radio buttons and resets any fields made visible by said radio buttons. As you suggested I added xfa.form.remerge(); which made the visible fields reset.
    Heres the code i used.
    var
    answer = xfa.host.messageBox("Are you sure you want to reset the form?","Confirmation Required !!!",2,2);
    if
    (answer ==4)
      xfa.host.resetData();
    xfa.form.remerge();

  • Problem with JavaScript in my PDF Form buttons

    I am trying to have my user click on a button in my form on my website and e-mail the form data to me.
    I am using the following JavaScript with my form button:
    this.mailForm(false, "[email protected]", "", "", "Subject", "Message Body");
    Protected mode is off.
    When I use the above statement (whether the 1st parameter is set to true or false), nothing happens – no email gets sent and no mail dialog box appears. If I change from this.mailForm(...) to this.mailDoc(...), I get a mail dialog box but, as expected, it sends the blank form without the filled-in data due to low user privileges.
    How can I send the form data with this.mailForm(...)? (Note that I prefer to use this.mailForm(...) rather than mailto:(...) because this.mailForm(...) supposedly allows me to e-mail the form without user interaction.)
    -- Don

    Thanks for responding.  I have been using “Submit a form” in the Mouse up event.  I had that operation do a mailto: and it worked, but required user interaction on the part of the web page visitor.  I have successfully created an equivalent JavaScript including:
        var url = "mailto:[email protected]?subject=mySubject&body=MyMessage"; 
        this.submitForm(url, true);
    The above sent the FDF file successfully, but again, it required user interaction.
    Then I tried this JavaScript - as I mentioned in a previous post - after you said to use doc.submitForm():
        var url = "http://mydomain.com/submit_notice.php";
        doc.submitForm(url, false);
    The above script seemed to do nothing (with no error message). Shouldn't it bring up the PHP file in the web browser?
    I have that php file, submit_notice.php, created, but I have not written any PHP scripts to e-mail the FDF file.  I have never written a PHP script to take the posted FDF data and email it, but I have used the PHP mail() function and posted variables.
    As for what I want to happen on the client side after the submit takes place: I simply want the FDF file to go to an e-mail that I specify.  Additionally, I need it to happen without any client interaction on the part of the web page visitor.  I can expect that visitor to have Adobe reader, but no add-ons or protected mode requirement.
    Please give me an example that emails the FDF file without any user interaction.
    Thank you.
    -- Don

Maybe you are looking for