Javascript help needed (confirmation for cancel button )

Hi guys!
I am not good at javascript but am going to improve shortly :-). Now i need very quick fix.
I'm using <html:cancel> button in Struts 1.1 and I'm using without thinking the following code:
<html:cancel onclick="bCancel=true;" >
<bean:message key="cancel.operation"/>
</html:cancel>
It is not that important though. I would like very much to alert user on possible loss of data (long multipaged form - could press mistakingly, who knows).
Would you, please post the javascript code that is needed to accomplish this - just alert and if yes - cancel, no - leave alone?
I'll really appreciate this.

Thank you for your response.
I also manage to write this. Is this correct?
<script language="JavaScript">
function ensure() {
return confirm("Are you sure that you want to cancel this operation?");
</script>
<td colspan="3" align="center">
<html:cancel onclick="bCancel=ensure();" >
<bean:message key="cancel.operation"/>
</html:cancel>
</td>

Similar Messages

  • Help please!  I need code for a button to stop a movieclip, when both are in a nested animation.

    I'm working on a project that has a button and a movieclip, which we want the button to stop, both nested in a movieclip on the main timeline.
    The button instance = muteBtn
    The clip to stop instance = backmusic
    The movieclip they are nested in = ecard
    There's also a preloader that works just fine on the main timeline.
    I've seen a wide variety of ways to stop a streaming MP3 and they all look way too complicated for my current Flash knowledge level.  As far as I know, if the MP3 is in a movieclip, stopping that clip will also stop the MP3.  If that's just dead wrong and what I'm trying to do will never work, please just let me know so I can struggle in another direction.
    What I'd prefer though would be the coding to make this button work.  I've tried a wide variety of ways to code something that seems like it should be so simple, and keep getting the error "Access of undefined property muteBtn".  I'm assuming this means it can't find the muteBtn in the nested layer.  How do I better define the muteBtn?  Do I then need to add something else that more clearly defines where the clip I want it to stop is since it is nested too?  PLEASE HELP ME!! Thank you in advance!
    Some of what I've tried:
    function endMusic(e:Event):void {
        ecard.backmusic.stop();
    or
    function endMusic(e:Event):void {
        backmusic.stop();
    with...
    muteBtn.addEventListener(MouseEvent.CLICK, endMusic);

    When you target objects, you need to consider the path to the object based on where you are trying to target from.  So if your code is in the main timeline and your button is inside a movieclip, then you need to target the button via the movieclip...
       movieclipName.muteBtn.addEventListener(MouseEvent.CLICK, endMusic);
    As far as stopping a moiveclip resulting in stopping a sound from playing, it is not likely to work.  To stop a sound you need to target the sound to stop it.

  • Listener for cancel button of dialog

    Hi
         What shud i add as listener for the dialog , so that when i press cancel button the listener shud get executed?. Alos is there any listener to know if the user has pressed the close(x) mark of the dialog and closed the dialog. Any help wud be appreciable
    Thanks
    Veena

    try beforesubmit handler
    Ref:
    http://dev.day.com/docs/en/cq/current/widgets-api/index.html?class=CQ.Dialog

  • Javascript Help Needed Again

    Hi there, I am not very good with Javascript, so was looking
    for some help.
    I have a select list for an order checkout page, which is
    basically how
    people heard about the site. You select one, and depending on
    what it
    is, another form field will appear with a message asking for
    more detail.
    For instance, if they selected Search Engine, another field
    would appear
    with the text "Which search engine" and a form field for them
    to enter
    it into.
    What is the best way to do this? Some of the options in the
    select list
    won't need the additional field.
    Cheers,
    Steve

    Dooza wrote:
    > Dooza wrote:
    >> Hi there, I am not very good with Javascript, so was
    looking for some
    >> help.
    >>
    >> I have a select list for an order checkout page,
    which is basically
    >> how people heard about the site. You select one, and
    depending on what
    >> it is, another form field will appear with a message
    asking for more
    >> detail.
    >>
    >> For instance, if they selected Search Engine,
    another field would
    >> appear with the text "Which search engine" and a
    form field for them
    >> to enter it into.
    >>
    >> What is the best way to do this? Some of the options
    in the select
    >> list won't need the additional field.
    >
    > Ok, I have almost got this sussed, just need some syntax
    help :)
    >
    > function toggleElement(sel1, element1) {
    >
    > element1 = document.cart.elements[element1];
    > //alert(element1.value);
    > if (sel1.value == 'searchenginelisting') {
    > element1.value = 'Which search engine?';
    > element1.style.display = 'inline';
    > }
    > if (sel1.value == 'searchenginesponsored') {
    > element1.value = 'Which search engine?';
    > element1.style.display = 'inline';
    > }
    > if (sel1.value == 'banner') {
    > element1.value = 'Which website?';
    > element1.style.display = 'inline';
    > }
    > else {
    > element1.value = ''; // input text will be empty
    > element1.style.display = 'none'; // hide text element
    > }
    > return;
    > }
    >
    > It currently only works when you select banner from the
    select list.
    > When you select the first 2 it does nothing. Its the way
    its nesting the
    > IFs, can anyone tell me how to sort this out?
    >
    > Cheers,
    >
    > Steve
    function toggleElement(sel1, element1) {
    var element1 = form.elements[element1];
    if (sel1.value == 'searchenginelisting' ||
    sel1.value == 'searchenginesponsored'){
    element1.value = 'Which search engine?';
    element1.style.display = '';
    return;
    if (sel1.value == 'banner') {
    element1.value = 'Which website?';
    element1.style.display = '';
    return;
    element1.value = ''; // input text will be empty
    element1.style.display = 'none'; // hide text element
    Mick

  • Data loss popup for cancel button on overview page

    Hi Experts,
    Data loss popup generally appears on UI, when i try to navigate with out saving the changes. This is a standard SAP behaviour.
    But, i come across the requirement where this data loss popup should also appear on clicking the 'Cancel' button on overview page on UI.
    I understood that, this popup will be triggered by the methods ON_BEFORE_WA_CONTENT_CHANGE & IF_BSP_WD_EVENT_HANDLER~HANDLE_EVENT of the window impl class.
    Please suggest how can i make this popup work in case of Cancel button as well.
    Thanks....

    Hi bkvs,
    Usually when you click the "Cancel" button that means you don't want to save your entry... hence displaying the dataloss popup doesn't make really sense to me. However, you may want the user to confirm that he really wants to cancel.
    So I would suggest to redefine the EH_ON_CANCEL method of your view, to display a simple confirmation popup before you actually cancel everything. This wiki will show you how to do it:
    Creating popup message in webclient UI - CRM - SCN Wiki
    Regards,
    Nicolas.

  • Help needed in refreshing a button array

    Hi,
    I am developing a GUI, in which window1 is in package pack1 & window2 in pack2. from window1, clicking "Add" button window2 appears.
    In window1, I am storing the content of a particular directory in my file system as a string array. So, each string in the string array is used as the label of a button in the button array. The no. of buttons corresponds to the no. of files in the directory. window1 is having a panel that displays the buttonarray.
    In window2, I have created a textfield and a "ok" button. whatever textinput(string) I give to the textfield, after clicking "ok" that is stored as a file in the directory, to which window1 refers for its buttons.
    My requirement is: During runtime, when I am creating new files thru the textfield of window2,those files need to be added to the panel of window1 dynamically updating the directory content.
    So, how can I refresh the panel in window1 after adding a file thru textfiels in window2.
    If anybody has any idea about this, please let me know soon.
    Regards.

    Hello,
    I have not got the solution. So, still I am waitiong for the answer.
    If you have any idea, please let me know.

  • Help need driver for Mac Yosemite 10.10.2 for LaserJet Pro Color...

      Please help me find the driver for the HP LaserJET COLOR PRO 200 FOR MAC OXC 10.10 YOSEMITE
    This question was solved.
    View Solution.

    This should be what you need
    Driver for for OS X 10.9 Mavericks and OS X 10.10 Yosemite
    http://h10025.www1.hp.com/ewfrf/wc/softwareDownloadIndex?softwareitem=lj-125410-4&cc=us&dlc=en&lc=en...
    ****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
    2015 Microsoft MVP - Windows Experience Consumer

  • Need confirmation for [javaws.exe -uninstall]

    Hi,
    I need confirmation from the users before to uninstall the application.
    But by this way I am not getting any confirmation before uninstall the application.
    Eg : javaws.exe -uninstall URI<jnlp cache location>
    ( javaws.exe -uninstall "D:\Documents and Settings\sarayu\Application Data\Sun\Java\Deployment\cache\javaws\http\Dlocalhost\P8080\Tool\AMstartup.jar"
    Thanks,
    Sarayu.

    As Kent mentioned you need to create seperate package for this KB and then advertise that with uninstall program.
    There is a blog post re: the same (I've not tried it). May be you can give try?
    http://trevorsullivan.net/2011/05/31/powershell-removing-software-updates-from-windows/
    Anoop C Nair - Twitter @anoopmannur
    MY BLOG:
     http://anoopmannur.wordpress.com
    SCCM Professionals
    This posting is provided AS-IS with no warranties/guarantees and confers no rights.

  • Menu Button not working at all..Please help needed urgently for deadline.

    I have used all the suggestions I can find in the forum. Nothing is working.
    I am trying to draw button rectangle on a still background for a menu. Draging the pointer doesn't do anything. I have tried to import a tutorial with menu and buttons within it. When loading the project assets the import stops at "Loading menu" and does not proceed.
    I am using suitcase fusion for a font manager.I have reinstalled the DSP a few times without any success.
    I have spent three nights trying to solvge the problem and I am running out of time for the project delivery help is need urgently

    Your key is the "suitcase fusion for a font manager" line.
    There is a bug where you won't be able to create a button if you have a bad font, or a duplicate font, installed.
    First try shutting off all of the fonts you have open with Suitcase, and see if that helps. If so, open one suitcase at a time until you figure out which font is the culprit.
    If shutting off all but the basic System fonts does not help, you might have to reinstall your system, or somehow update your core System fonts. I don't know how to do that, but there was a recent article at http://www.tidbits.com/ that discussed fonts and their maintenance. But ultimately it's a font problem.

  • Need drivers for FN buttons Win 7 64bit for Satellite A500D PSAN3E

    I was installing windiws 7 (64) and im collecting my drivers again...
    Dont seem to find the driver for the (fn) button keys again... can anyone help me find this driver?
    Toshiba Satellite, A series, A500d, PSAN3E, windows 7 (64)
    Please anyone..??

    Hi
    You need to install the Toshiba Flash Card Support Utility to get the FN button working.
    Take a look into the Satellite L500 driver area
    There should be a Toshiba Flash Card Support Utility.
    Download it, install it, reboot the notebook and then check the FN button functionality.
    Greets

  • Help needed please for master socket wiring

    I am renovating a house built in the 1970's which I shall be moving into shortly.
    My electrician has put in telephone sockets in two of the bedrooms but when he came to the master socket he found the builders had by mistake cut the wire too short so he could not make a connection.
    The master socket is in the hall low down on the wall and it looks as if the wire comes into the house underground.
    I have spent hours on the telephone trying to get the right person to speak to at BT who tells me I need to contact Open Reach as it is damage and when I eventually found a number to ring them they tell me it is BT's problem.
    In exasperation I telephoned the moving house line as none of the press button numbers seemed relevant.
    I just want a BT person to come and have a look to see what to do but they have told me that I need to give them a date for when I move and they will come and look then.  However, I need the builders to fill in the large hole in where the wire comes into the house so I can have a floor laid.
    Any help would be so much appreciated

    Hi Kh,
    Thank you for your post and welcome to the forum. If you would like a BT Engineer to go out and take a look at your line this can bee arranged when you place an order to activate the service. With the line being damaged by the builder, there will be a charge of around £127.99 to activate the service.
    If you need any help placing your order to activate the service, please drop me an email with any BT account details, along with the address details for you new property. My email address is [email protected]
    Thanks
    Paddy
    BTCare Community Mod
    If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
    We are sorry but we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-)

  • Math.min JavaScript help needed

    Hello,
    I am trying to write a script for a fillable PDF in Adobe Acrobat, but I don't have much experience with JavaScript and I need some help!
    Basically I have three fields as follows:
    A1 = a field with a number value in it
    B1 = a field with a number value in it
    C1 = a field where the sum calculation will be.
    I want to write a script that will enter the lesser of the values in A1 and B1 into C1. If no value has been entered into B1, then it enters the value of A1 into C1.
    This is what I have come up with so far:
        // Get the field values, number fields as numbers
        var d1 = getField("A1").value;
        var d2 = +getField("B1").value;
        // Set the field value to either A1 or B1, whichever is lesser
         event.value = Math.min(d1,d2);
    Some of the problems with the script so far are:
    It does not calculate correctly if there is no value entered in B1 (should give just A1).
    It doesn't update the event.value if A1 is changed (until another form field is modified)
    Can anyone help??
    Thanks!

    Adjusted the field calculation order fixed question 2.
    The script given as answer worked great except for one area.
    B1 values can range from 0 and up. If a 0 is entered in B1, then the Math.min ignores it since d2=="".
    I can get around that problem by having a default value set in B1 of -1 (outside of the range). I'd prefer that there not be a default value set.
    Any suggestions? I appreciate the help.

  • If/then JavaScript help needed

    Hello,
    I am trying to write a script for a fillable PDF in Adobe Acrobat, but I don't have much experience with JavaScript and I need some help!
    Basically I have five fields as follows:
    A1 = a checkbox
    B1 = a field with a number value in it
    C1 = a field with a number value in it
    D1 = a field with a number value in it
    E1 = a field where the sum calculation will be.
    I want to write a script that will enter the sum of values of B1+C1+D1 into E1 if the checkbox in A1 is checked yes.
    If it is not checked yes, then it will enter the sum of values of B1+C1+ the value of D1 divided by 2 (and rounded down) into E1.
    Can anyone help??
    Thanks!

    This should do it as the custom Calculate script for E1:
    // Custom calculate script
    (function () {
        // Get the field values, number fields as numbers
        var a1 = getField("A1").value;
        var b1 = +getField("B1").value;
        var c1 = +getField("C1").value;
        var d1 = +getField("D1").value;
        // Set this field (E1) value based on the state of the check box
        if (a1 === "Off") {
            event.value = b1 + c1 + d1;
        } else {
            event.value = b1 + c1 + Math.floor(d1 / 2);

  • Javascript Help needed

    We have a requirement to not display report until the user selects some requirements, and we also need to ensure a user has selected a value for certain prompted columns.
    As such, we have written a custom Javascript for a custom "Go" button on our dashboards. The JS validates the required fields and generates a Go URL which loads into an iFrame when the custom button is clicked. This works fine in Internet Explorer, but in Firefox the prompt values are not being passed into the Go URL string. This is a security risk as it shows all data on the report when it shouldn't for certain users. Can anyone look at the JS code below to see why it won't work in Firefox?
    Thanks
    removed code, sorryEdited by: odinsride on Feb 10, 2011 9:17 AM

    if(navigator.appName == 'Microsoft Internet Explorer')That would be the reason your code doesn't work in Firefox - most of it is inside an IE-only if clause!
    Surely there must be a better way to achieve your requirement rather than to use all that javascript. One technique I've used to force a user to make a prompt selection is to use nonsensical default values on your prompts. By doing this you are guaranteed that the report will give 'no results' when it is first run. You can then add a no results view to the report and add your own custom message saying 'please make some selections from the prompts above'.

  • Javascript Help Needed to Show/Hide Regions

    version 4.0.2.00.07
    Hello,
    I'm hoping that someone would help me with creating a Javascript function to Show/Hide regions.
    I have a Select List defined as Checkboxes that when clicked I would like to show specific regions that contain fields that are specific to that checkbox selection. There are currently four selections available. There are two selections that would show one region and the other two selections would show the other region.
    Please let me know if I need to clarify anything.
    Thanks,
    Joe

    There is an out-of-box solution that may help you - check out the "Customisation" section in the region properties.
    Otherwise, you might like to explore using a Dynamic Action to show/hide your region based on an event on your relevant checkbox.
    Either way, you should have a declarative solution when you thought you might need to hand-code some javaScript :-)
    ps - thanks for providing your Apex version.

Maybe you are looking for

  • Jiminicricket's custom click boxes

    I would've private-messaged the topic starter on this, but for some reason it's not working. I just wanted to make sure Jimini took a look at my suggestion in his now appearing to be 'Answered' thread. Keith

  • DEFAULT ROLE FOR USER

    I swich to Oracle11g express and create user CREATE USER LEO IDENTIFIED BY xy DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK; -- 3 Roles for LEO GRANT AUTHENTICATEDUSER TO LEO; GRANT CONNECT TO LEO; GRANT FER_ADMIN

  • Transport Request status table

    Hi All, In se10, for a given transport id, i can check the status, i.e. if it has been transported to quality & production systems. I would like to know in which table i can get this info, i.e. when it was transported to QAS & PRD I am able to get th

  • I cannot find the new data in the database

    Hi I'm newbie at SQL. I read and watched a lot about the SQL. But still can't figure out the problem. THE PROBLEM: we are using accounting software for our business. the software keeping records of clients names and other information. when I open the

  • While erasing memories from iPhone 4, the phone gets switched off and can't turn on back

    while erasing memories from iPhone 4, the phone gets switched off and can't turn on back. Please help.