Struts : checkbox status is unchanged if i use back button and uncheck it.

hi
I have a couple of checkboxes in a jsp page used in struts framework. I am using DynaValidatorForm as form bean with session scope, so it means the properties are mapped only in the struts-config.xml. the checkboxes' property names are checkbox1 and checkbox2.
now the in the action class, i do:
public ActionForward execute(ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response)
     throws Exception {
          DynaValidatorForm dynaform = (DynaValidatorForm)form;
                                          System.out.println("1st checkbox value:"+ dynaform.get("checkbox1") );
                                          System.out.println("2nd checkbox value:"+ dynaform.get("checkbox2") );
}Now if I check the first checkbox and press on submit button, the action class prints out:
1st checkbox value: on
2nd checkbox value: off
this is as expected
Now I click on the back button, then i uncheck the first checkbox and click on submit.
the output is same as before, i.e.:
1st checkbox value: on //wrong
2nd checkbox value: off
I expected it to be
1st checkbox value: off
2nd checkbox value: off
That means if in a session if i check on checkbox 'on', and i go back and uncheck it, the uncheck is never stored, i.e. the property is never set to 'off' .
Now if i check the second one, and click on submit, output is :
1st checkbox value: on //expected off
2nd checkbox value: on //correct
now i go back and uncheck the 2nd checkbox (the first checkbox is already unchecked before), click submit and i get this output:
1st checkbox value: on //expected off
2nd checkbox value: on //expected off
Please let me know what is happening. I expect the values of uncheck boxes to be 'off'
thanks
Tanveer

The String[] thing is only useful when you have multiple checkboxes of the same name.
What is the scope of the form bean? Request or session? If it's request, then that makes no sense. If it's session, then it does make sense because the same bean is being used, and as a result, the values are not really reset. And since HTML forms work by not submitting anything for unchecked checkboxes, then the server doesn't get anything in the request form data to know to change the checkbox to any other value.
If you are using session scope, then make sure you have a good reason to. Otherwise, use request.

Similar Messages

  • Use back button and clear advanced action and quiz answer..

    OK, so I have made a quiz where the answer for each question is recorded and given in a list at the end. However, I would like the user to be able to go back and change their answer. At the moment if the user goes back, the answer is locked and they cannot chose a diiferent option.
    Does anyone know if it is possible for them to go back, select a different and still have the advanced action part record the new answer?
    Thanks for any help!

    Only way to reset the answers to a default question slides, during the same session, is to use the Retake button on the score slide (you need to have multiple attempts of course. But that will be done at Quiz level: all answers are reset.
    Another option (in CP6 and later) is to use the Submit all option, then they will be able to go back and change answers. But... I suppose you are using the system variable cpQuizInfoAnswerChoice to populate user variables with those advanced actions? That system variable is not populated when Submit all is chosen.
    Last option is to use remediation, but it will probably not suit you: then user can be sent to a content slide if a question is failed, be sent back to the question slide and can then change the answer. It is not just going back one or more slides.
    Custom question slides will allow what you want, but they necessitate a lot more work and you will not be able to use question pools.
    Lilybiri

  • My back button and refresh button and my yahoo tool bar are dimmed a lot when I open up firefox. So as a result, I cannot use the back button nor my refresh button AND my yahoo toolbar disappears a lot. I have tried to get on your chat session but it is a

    <blockquote>Locked by Moderator as a duplicate/re-post.
    Please continue the discussion in this thread: [/forum/1/688252]
    Thanks - c</blockquote>
    == Issue
    ==
    I have another kind of problem with Firefox
    == Description
    ==
    My back button and refresh button and my yahoo tool bar are dimmed a lot when I open up firefox. So as a result, I cannot use the back button nor my refresh button AND my yahoo toolbar disappears a lot. I have tried to get on your chat session but it is always closed. I need one on one help. Please reply with resolution.
    == This happened
    ==
    Every time Firefox opened
    == two or three months ago
    ==
    == Firefox version
    ==
    3.6.3
    == Operating system
    ==
    Windows XP
    == User Agent
    ==
    Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 (BT-canvas) Firefox/3.6.3 GTB7.0 (.NET CLR 3.5.30729)
    == Plugins installed
    ==
    *-npdnu
    *npdnupdater2
    *Coupons, Inc. Coupon Printer DLL
    *Coupons, Inc. Coupon Printer Plugin
    *The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
    *6.0.12.448
    *RealPlayer(tm) LiveConnect-Enabled Plug-In
    *RealJukebox Netscape Plugin
    *Default Plug-in
    *Adobe PDF Plug-In For Firefox and Netscape "9.3.2"
    *BrowserPlus -- Improve your browser! -- http://browserplus.yahoo.com/
    *Shockwave Flash 10.0 r45
    *Yahoo Application State Plugin version 1.0.0.7
    *3.0.50106.0
    *My Web Search Plugin Stub for 32-bit Windows
    *Google Updater pluginhttp://pack.google.com/
    *Google Update
    *Next Generation Java Plug-in 1.6.0_20 for Mozilla browsers
    *Npdsplay dll

    * If the menu bar is hidden then press and hold the Alt key down, that should make the Menu bar appear (Firefox 3.6 on Windows) (see [[Menu bar is missing]]).
    * Make sure that you have the ''Navigation Toolbar'' and other toolbars visible: View > Toolbars .
    * If items are missing then see if you can find them in the View > Toolbars > Customize window.
    * If you see the item in the Customize window then drag it back from the Customize window to the Navigation toolbar.
    * If you do not see that item then click the Restore Default Set button in the View > Toolbars > Customize window.
    See also [[Back and forward or other toolbar buttons are missing]] and [[Navigation Toolbar items]]
    See http://kb.mozillazine.org/Toolbar_customization

  • Using back button to clear data

    I have a several JSP pages that help create a report. The first page you choose some options using check boxes. The second page you put those options in a certain order. The last page you choose the data you want to search for and it runs the report. The second and the last pages have a back button. The problem is when you use the back button and change some of your choices the old choices don't always go away. What I need to do is erase the previous choice (which are contained in an array) when the back button is clicked.
    One problem is that the array is declared in a different method than the one that determines what happens when the back button is pressed.

    You can use reset funcyion to clear data on back button.
    Cheers
    Varun Rathore

  • Active Focal Point Not Shown in Software Using Back Button Focus

    I use Back Button Focus (BBF) and set the focus point (using center spot).
    In the software (DPP, ZoomBrowser or EOS Utility) the point I selected is not highlighted in the view window.
    All points are shown, but none highlighted.
    If I take the same shot using default focus method (shutter button AF), the point is highlighted .
    Why is this?
    Not too technical, please
    Canon 3Ti, EF 50mm f/1.4 USM, EF-S 18-55mm f/3.5-5.6 IS II, EF-S 55-250mm f/4-5.6 IS II, 320EX Speedlite

    Thanks.
    I did just download and install the updates (DPP, EOS, Picture Style Editor and Zoom Browser).
    Still no red focus point(s) shown with Back-button Focusing.
    I searched on the web for this "symptom" and found, that I'm not alone.
    It seems in Back-Button Focusing, the focus point won't be displayed unless you hold the back button down (* button  in my case) while pressing the shutter button.
    I tried holding the * button while taking a shot and yes the red box shows up.
    This seems like defeating the usefulness of back button focusing. (???).
    What do I know? I'm just a newbie.
    Canon 3Ti, EF 50mm f/1.4 USM, EF-S 18-55mm f/3.5-5.6 IS II, EF-S 55-250mm f/4-5.6 IS II, 320EX Speedlite

  • I restored my iPhone, then I set it up and used it without syncing it to my computer. When I plugged it in, it used back-up and now everything I did before I did the back-up is gone. Can I get those pictures back somehow?

    My iPhone was restored. I set it up without syncing it to the computer. I used it. I then plugged it into the computer. It used back-up and made it just like it was before I restored it. Everything I did before I plugged it in is now gone. Is there any way to undo that to get those pictures back?

    when you open the app store scroll down to the bottom it will display the apple id currently in use, change it to your normal apple id email

  • How to upload using  upload button and want to process it....

    Hi,
    I need a program to upload a file [Excel file] using upload button and
    want to process the excel sheet and store the data in database.
    I know that we can upload using Html - file type.
    but I dont know how to retrieve that uploaded file to process it?
    I mean , Is there any function like requset.getParameter() to get the uploaded file?

    Go to the [Apache Commons FileUpload homepage|http://commons.apache.org/fileupload] and carefully read the 'User Guide' and 'Frequently Asked Questions' sections from top to bottom (do not only focus on the code examples, but also on the article's text!!).

  • In my application on openeing a page mozilla browser history shows more than one entry which inturn makes it difficult to go the previous page using back button. It works fine in I

    In My application on opening a page using TOC, mozilla browser shows more thanon entry in history, which makes it difficult to browse the previous page using back button. Although it works fine on IE
    == URL of affected sites ==
    http://
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; MS-RTC LM 8)

    In My application on opening a page using TOC, mozilla browser shows more thanon entry in history, which makes it difficult to browse the previous page using back button. Although it works fine on IE
    == URL of affected sites ==
    http://
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; MS-RTC LM 8)

  • Need help trying to use close button and i really like to know why it off

    need help trying to use close button and i really like to know why it off

    And in English? You need to explain better.
    Mylenium

  • I have a problem with my iphone 5s. recording a vid using back lens and no sound but on the rear lens there is a clear voice.. anyone with any answers???

    I have a problem with my iphone 5s. recording a vid using back lens and no sound but on the rear lens there is a clear voice.. anyone with any answers???

    Hi, Nurlynn.  
    Thank you for visiting Apple Support Communities.  
    I would need clarification on this issue to provide a better answer.  However, here are a couple articles that I would go through when experiencing issues with the Mic and Camera.  
    If your voice is too faint or sounds unclear using iPhone, or iPod touch
    http://support.apple.com/kb/ts5183
    Get help with the camera on your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT6350
    Cheers, 
    Jason H.  

  • I cant download anything including Updates, when i try to download a black box appears saying that i have to power off the laptop using the button, and it freezes, so i have no option but to power off. Please HELP

    I cant download anything including Updates, when i try to download a black box appears saying in 4 different languages that i have to power off the laptop using the button, and it freezes, so i have no option but to power off. Please HELP

    Well, at least it's good that there are no hardware issues - that's a relief and one problem area that you can check off.
    OK, so let's summarize so I can get a clear picture of what's going on. If you try to download something from your web browser, what happens? What if you try to download a small utility such as "EasyFind" from the App Store? Or is the problem specifically linked to downloading updates?
    I'm just trying to get a feel for if anything really means anything?
    Usually what you download from, say, a website, goes into your Downloads folder. It's the default folder for things like that. Apps from the App Store are downloaded to your Applications folder. And software updates are generally, I believe, held in a temporary folder so that they can be installed (in many cases) when you're asked to restart.
    It could be something as simple as repairing permissions on your start-up disk. You're running Snow Leopard, right? (That's what your profile says.) Try opening Disk Utility from your Utilities folder, selecting your boot disk and try verifying permissions. If you come up with some errors, try repairing permissions. After that, go ahead and verify your boot disk - you won't be able to repair it at this point, but at least you can see if you have any errors.
    Let me know about the anything and get back to me after you've verified and repaired permissions and verified your boot drive.
    Good luck,
    Clinton

  • Fire fow will not let me use curtain buttons and drop down menus for web sites. i had version 7.01 and upgraded to verson 8.02b and it did it on both of them. and the web pages work find if i use chrome

    Firefox will not let me use curtain buttons and drop down menus for web sites. i had version 7.01 and upgraded to verson 8.02b and it did it on both of them. and the web pages work find if i use chrome

    Do a clean reinstall and delete the Firefox program folder before (re)installing a fresh copy of the current Firefox release.
    Download a fresh Firefox copy and save the file to the desktop.
    *Firefox 21.0.x: http://www.mozilla.org/en-US/firefox/all.html
    Uninstall your current Firefox version, if possible, to cleanup the Windows registry and settings in security software.
    *Do NOT remove personal data when you uninstall your current Firefox version, because all profile folders will be removed and you will lose all personal data like bookmarks and passwords from profiles of other Firefox versions.
    Remove the Firefox program folder before installing that newly downloaded copy of the Firefox installer.
    *(32 bit Windows) "C:\Program Files\Mozilla Firefox\"
    *(64 bit Windows) "C:\Program Files (x86)\Mozilla Firefox\"
    *It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
    *http://kb.mozillazine.org/Uninstalling_Firefox
    Your bookmarks and other personal data are stored in the Firefox profile folder and won't be affected by an uninstall and (re)install, but make sure that "remove personal data" is NOT selected when you uninstall Firefox.
    If you keep having problems then also create a new profile.
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    *http://kb.mozillazine.org/Profile_backup
    *http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Clean_reinstall

  • My power button doesnt work, jammed. How can i reset my phone if i cant use power button and home key to reset?

    my power button doesnt work, jammed. How can i reset my phone if i cant use power button and home key to reset?

    snystrom wrote:
    my power button doesnt work, jammed.
    Is this an iPhone 5?
    If so, see this -> iPhone 5 Sleep/Wake Button Replacement Program

  • Traversing from one screen to the previous one using back button

    Hi all,
            I am new to the forum and want the help of the experts over ther for this doubt i encountered. I want to know how we can traverse from one screen to the  previous one using the back button. Like if presently i am in 4th screen if i want to go back directly to the 2nd one then how to do that.
            Kindly help me by clarifying this doubt.
    Thanks

    Hi Jana,
    If u r using the screen painter then u need to create  a button and in status there.code as set pf-status.
    case sy-ucomm.
    when 'back'.
    leave to screen <screen number> here if u want to go to the other screen i.e to screen 200 ffrm 400 then u can code it as
    leave to screen 400.
    or else code it as
    if screen = '200'.
    leave to screen 400.
    try this eg it might work ..
    regards,
    sana.
    reward points for helpful answers.

  • Using Back Button after Display Report

    Hi,
    Need an advice, i need to customize the standard BACK button after report had been displayed, trying to use AT USER-COMMAND, but still not avail..
    anyone can come with example will help me a lot.
    Thanks

    Hi badz lee,
    Just change the function code 'BACK' to 'ZBACK' in your custom GUI staus.
    Then write your own logic for the custmer needs.
    Hope this code helps.
    *& Report  ZVK_TEST
    REPORT  zvk_test.
    TABLES:ekko."for select option only
    SELECT-OPTIONS:s_ebeln FOR ekko-ebeln.
    DATA:lt_ekko TYPE TABLE OF ekko,
         lw_ekko TYPE ekko.
    START-OF-SELECTION.
      SET PF-STATUS 'STLI'."copy status STLI of program SAPMSSY0.
      SET TITLEBAR 'TITLE'.
      SELECT * INTO TABLE lt_ekko
        FROM ekko
        WHERE ebeln IN s_ebeln.
      LOOP AT lt_ekko INTO lw_ekko.
        WRITE:/ lw_ekko-ebeln,
                lw_ekko-bukrs,
                lw_ekko-bstyp,
                lw_ekko-bsart.
      ENDLOOP.
    END-OF-SELECTION.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'ZBACK'.
          PERFORM back_function."Your logic
        WHEN OTHERS.
      ENDCASE.
    *&      Form  BACK_FUNCTION
    FORM back_function .
      LEAVE PROGRAM.
    ENDFORM.                    " BACK_FUNCTION

Maybe you are looking for