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

Similar Messages

  • Firefox 32.0.2 - Blank window pops out when switching to "Settings", the only visible elements in it are buttons OK and Cancel.

    Windows 7 Ultimate, FF 32.0.2. Nothing but clickable buttons "OK" and "Cancel" is displayed in the Settings window, while everything else in the browser works as it should.
    You help me solve it? Thank you!

    Turned the Ghostery off, and - voila!
    I guess it isn't a Ghostery bug, though.
    Luckily it don't require to restart the browser. Thank you cor-el.

  • How to create a Dialog Box with two buttons (Acept and Cancel)?

    Hi i am devoloping an application (an applet) that has to throw a Dialog box, if i click on the Acept button makes some thing and if i click on the Cancel button the it makes other things.
    how could i throw this dialog message...?
    Thanks.

    The following would be the code needed for your dialog box:
         JDialog dialog = new JDialog();
         dialog.setModal(true);
         //the following window listener to the dialog box is optional
         dialog.addWindowListener(new WindowAdapter(){
              public void windowClosing(WindowEvent e){
                  System.exit(0);
              }//method
         JButton acceptButton = new JButton("Accept");
         JButton cancelButton = new JButton("Cancel");
         acceptButton.addActionListener(new ActionListener(){
              public void actionPerformed(ActionEvent e){
                  //do what you need to do
              }//method
         cancelButton.addActionListener(new ActionListener(){
              public void actionPerformed(ActionEvent e){
                  //do what you need to do
              }//mehthod
         Container cont = dialog.getContentPane();
         cont.setLayout(new BorderLayout());
         cont.add("West",acceptButton);
         cont.add("East",cancelButton);
         dialog.pack();
         dialog.setVisible(true); I hope this would be useful
    Rizwan

  • The "Software Update" buttons "Finish" and "Cancel" don't respond when I click them.

    A small popup will appear in the lower right of my screen stating that FIREFOX 32.0.2 is available for downloading. I click on "Download Now". Another larger popup appears entitled "Software Update".
    This is completely blank except for three buttons in the lower right corner. The first is suppressed. The second, "FINISH" is enable. When I click on it, nothing happens. The third, "CANCEL" doesn't respond when I click on it either.
    This is my first experience with this issue. Normally I am able to download and install new releases of FIREFOX without incident.

    '''[http://www.mozilla.org/en-US/firefox/all/ Download Firefox Full Installer For All languages And Systems]''' {web link}

  • Condition on Page Button - Delete and Save

    I have condition not to delete are Update changes on the records which are Linked to Other records in the table so that those does not get orphaned. I am trying to do that with PL/SQL function returning Boolean .
    I Code goes like below.
    <Code>
    Declare
    v_found NUMBER := 0;
    BEGIN
    SELECT count(*) into v_found from cases
    WHERE lower(REGION) like lower(:P21_ID);
    IF v_found = 0 then
    RETURN true;
    ELSE
    RETURN false;
    END IF;
    END;
    </Code>
    But
    The condition does not seem to be firing right and I still see the DELETE and SAVe buttons on the page. Am I going wrong somewhere?

    Hi,
    Have you try write that as query and use Not Exists condition ?
    And you use like without %
    SELECT 1
    FROM cases
    WHERE lower(REGION) like lower('%' || :P21_ID || '%');Regards,
    Jari

  • About 2 Buttons, Yes and No. And 1 Textbox

    I got this problem.  I got 2 Radio Button and 1 text box
    O       O        [_________]
    Yes   No
    -- If I Click yes, The Text box will be visible and able to put text, And If I click no, I need the text box to be vanish/ Invisible.
    I do already try like If I click yes, I put in action (Mouse Enter) Show TextBox
    If I click No(Mouse enter) Hide TextBox
    This is the problem. If I click Yes, The Textbox will be showned but if I (JUST POINTED THE MOUSE "But not click it" To NO, The box is being invisible or Vanished. Help please!

    It's fine now. Next problem is. I got three different textbox to fill in
    If I click on textbox 1 = It needs to have an Background color so the user can see where she/he is typing. Then if I press TAB to move at second TextBox..... I need the TextBox1 Background color to be just plain. No color. And I need the 2nd textbox background color to be there.
    And also, I need to have. When I saved it. After filling it up. The file cannot be edited and the Background color of all textbox will be just plain. Thanks!

  • Back button forward button, refresh and cancel button all do not work they are always grey out and the drop down history by forward arrow doesn't work either

    when I go to another website the back button to the home button never works. the home button works. I can't do any or the above mentioned features

    This can be a problem with the file places.sqlite that stores the bookmarks and the history.
    * http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox

  • How I can internatiolization OK and Cancel buttons confirmDialog?

    private void clickButton() {
              int response = JOptionPane.showConfirmDialog(this, resBundle.getString("Confirmation_text_itroduction"),
    resBundle.getString("Confirmation_title"), JOptionPane.OK_CANCEL_OPTION,
                        JOptionPane.QUESTION_MESSAGE);
    if (response == JOptionPane.OK_OPTION) {
                   System.out.println("OK button clicked");
              } else if (response == JOptionPane.CANCEL_OPTION) {
                   System.out.println("Cancel button clicked");
    As you can see I internatiolization the title of confirm dialog and text (use object resBundle). OK!
    But how I can internatiolization OK and Cancel buttons is this confitm dialog?

    OK, I can internatiolization buttons "OK" and "Cancel" in confirm dialog:
    private void clickTestKindButton(String message) {
              Object[] options = { resBundle.getString("OK"),
                        resBundle.getString("Cancel") };
              int response = JOptionPane.showOptionDialog(this, message, resBundle
                        .getString("Confirmation_title"), JOptionPane.OK_CANCEL_OPTION,
                        JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
              if (response == JOptionPane.OK_OPTION) {
                   new IntroductionTest();
              } else if (response == JOptionPane.CANCEL_OPTION) {
                   System.out.println("Cancel button clicked");
         }It's work OK!
    But how I can internatiolization buttons "OK" and "Cancel" in the input dialog ?

  • Dialog Pop-Up screen with Continue and Cancel Icons

    we should have to enter Purchase Order and Item in the pop-up, How?

    hi
    create a modal dialog box screen and give purchase order and item as text box and using pf status put buttons continue and cancel
    call the screen by using the co-ordinates
    eg:
    call screen 100 starting at 10 10
                           ending at  50 50.
    Regards,
    Prashant
    *reward if helpful

  • Why am I only able to post a comment on Facebook only after I click on the "reload current page button"?

    This problem just started a couple of days ago. I had no problems before doing these simple tasks before. It is quite annoying to me that I have to continually click on the "reload current page" button each and every time I want to post a comment on Facebook. Does anyone know what the problem may be?

    I notice you turned off the setting that diverts new windows to a new tab. Since the new window will open in front of your current tab, it may appear that the current tab was closed, when in fact it is behind the new window. This hard to explain in words.
    Do you want to switch the setting?
    orange Firefox button (or Tools menu) > Options > Tabs
    Check the box for "Open new windows in a new tab instead"
    Does that help?

  • Would like to change my home page. I click on options and my general tab is blank with only the ok and cancel buttons showing. How do I fix this?

    In options, under the general tab, it is blank all except the ok and cancel buttons. I can't change my home page. Please help.

    Hi cor-el,
    Thank you for your reply. Before I had seen your reply. I went into options and under general, all of a sudden it showed what should be there. I closed browser and did it again and it didn't show. It has been blank for roughly two months. Just seems funny that I ask a question and after all this time of not showing what it should, it does, to only be blank again.
    I have also been trying to update the flash player. That comes up completely blank as well with nothing showing at all. I did this several times the day before I posted my question. That same day I also hit the reset button for firefox when I was having trouble trying to update the flash player.
    I did as you said to do. Nothing has changed. Is there something else that I could try?

  • Yes, No and Cancel Buttons on Pop-Up for BACK or NEW button

    Hi Experts,
    First scenario:
    We have crated few mandatory fields in incident when ever we are not filling the mandatory fields and try to SAVE (Incident Tool bar button) the Incident, it will Check for any Error Messages, before saving the Document,
    If entries not found in mandatory fields record will not get saved.
    This functionality we are controlling in EH_ONSAVE method of the SRQM_INCIDENT_H/IncidentOV.
    Second scenario:
    But After filling few fields in Incident screen, If I click on NEW button for a new incident or BACK button ,  it give one popup with message Do you want to  save the changes ? With Buttons Yes, No and Cancel. If I click on the Yes button Incident gets saved with an IRN number without entry of any mandatory data.
    How can I control the second scenario as first scenario? Please suggest how to controll Yes, No and Cancel Buttons on Pop-Up for BACK or NEW button as SAVE button.
    Thanks in advance
    Chand

    hi,
    you can control  the pop-up SAVE button without saving your details or write your ownlogic on pop-up save.
    please refer to this post.
    Re: Suppress POP-UP
    regards
    Ismail

  • How to handle "ok" and "cancel" button of dialog popup?

    Hello everyone,
    I'm using a dialog with type="okCancel". My question is how to handle ok and cancel button of this popup window. Here is my code below:
    <af:popup id="kriterPopup">
    <af:dialog title="Kriter Seçiniz" type="okCancel" inlineStyle="width:500px;height:400;" id="d2"
    dialogListener="#{BasvuruDegerlendirmeBean.kriterDialog}">
    <af:selectManyCheckbox label="Kriterler :" id="smc2"
    binding="#{BasvuruDegerlendirmeBean.kritersCheckbox}">
    <af:forEach items="#{BasvuruDegerlendirmeBean.kriterList}" var="item">
    <f:selectItem itemLabel="#{item.ybKriter.tur}" itemValue="#{item.ybKriter.tur}" id="si3"/>
    </af:forEach>
    </af:selectManyCheckbox>
    </af:dialog>
    </af:popup>
    I want to handle ok and cancel button of this window, and redirect to the pages which I want.
    Can anyone help me how I can do?
    Thanks, with my regards.
    Ali

    You need dialogListener..
        public void dialog1_dialogListener(DialogEvent dialogEvent) {
            if (dialogEvent.getOutcome().equals(DialogEvent.Outcome.yes)){ //for Yes
            }else{ //for Cancel
        }

  • Creating a dialog box with OK and Cancel buttons without OADialogPage

    Hi Experts,
    i want to create a dialog box for Delete Confirmation means after clicking on delete it should pop up a small dialog box with OK/Cancel buttons
    and need code for the same to handle the buttons.
    i have created with OADialogPage but its showing in a complete page but i want to show those buttons in a small box.
    Plz help.
    THANKS IN ADVANCE.
    Thanks
    Raja.

    Hi,
    I have not tried using javascript in destination URI as suggested by Mukul.
    I have tried the below code for opening a page as dialog box.
    You can try it for your requirement by creating a dialog page of your own, say XXDialogPage (with OK and Cancel button)
    StringBuffer l_buffer = new StringBuffer();
    l_buffer.append("javascript:mywin = openWindow(top, '");
    String url = "/OA_HTML/OA.jsp?page=/xx/oracle/apps/fnd/dialog/webui/OADialogPG";
    OAUrl popupUrl = new OAUrl(url, OAWebBeanConstants.ADD_BREAD_CRUMB_SAVE );
    String strUrl = popupUrl.createURL(pageContext);
    l_buffer.append(strUrl.toString());
    l_buffer.append("', 'lovWindow', {width:500, height:500},false,'dialog',null);");
    pageContext.putJavaScriptFunction("SomeName",l_buffer.toString());
    In dialog page's controller, you can forward it to the page onc ethe user selects OK or Cancel.
    Pass the selected value back to the main page and further you can use it for deleting.
    Regards.

  • Mapping enter and esc to ok and cancel buttons

    Hi,
    Does java's fine API offer any method of mapping Enter and ESC to OK and Cancel buttons in a customized JDialog?
    The current way I'm doing it is through a brute force of adding a KeyListener to every component in the dialog box (in an automated way), is there another way?
    Any suggestions would be appreciated.

    Uh oh, should I be scared because he knows more about
    Swing than just about anyone?
    Yes. Because if you really get stuck then he won't help you and then you are doomed.
    If anybody was rude it was him, and if anybody is an
    idiot it's you. See how easy it is to make claims
    without providing any reasons or rationale?Reasons and rationale have been provided but I guess you didn't grasp them the first go around so here goes.
    1) You were impatient
    You waited 30 minutes before whining and bumping. That is impatient. Nobody is being paid to deliver answers to you.
    2) You posted in the wrong forum.
    This is not the Swing forum is it? No it is not.
    3) You should learn to search
    If you had searched for even up to 15 minutes (and you wouldn't have needed this long) then you would have had your answer in half the time. Searching saves YOU time.
    4) You were rude
    When the facts (and please note the use of the word "fact" not personal opinion) above were pointed out to you then you were rude.
    Finally the "you are an idiot" problem. I will give you this is the most subjective of the lot although given that you cannot dispute ANY of the above facts (although you seem to be trying and that's helping to make the case that you're quite the idiot) that's really not saying much.
    However, it seems to me that if Person A wants the assistance of Person B (who is a valuable resource of information for person A and others) it does not seem wise for Person A to be rude to person B. So in the case of Person A who is rude to Person B who they are relying on as a free resource we can make the assertion that Person A is an idiot.
    In case you couldn't follow that you are Person A.

Maybe you are looking for