Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6788739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:31:15+00:00 2026-05-26T17:31:15+00:00

I have a screen where i want the components disabled when i first traverse

  • 0

I have a screen where i want the components disabled when i first traverse to the screen(view mode). When i click on Edit button an action is fired and i reload the same screen with the components (cName and cStatus) as editable. Previously, i couldn’t retain the values of cID, cName and cStatus when the screen was reloaded so i made 3 hidden fields with the same names. Now i am able to retain the values of all the 3 pages in editable mode(modify mode).

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <%@ taglib prefix="s" uri="/struts-tags"%>
 <html>
 <head>
 </head>
 <body>
 <s:form name="c" validate="true">
<s:hidden name="cID" />
<s:hidden name="cName" />
<s:hidden name="cStatus" />

<table cellspacing="0" cellpadding="3">
    <tr>
        <s:if test="%{mode=='view'}">
            <td><s:submit name="btnEdit" value="Edit" onclick="onEdit()" /></td>
        </s:if>
        <s:elseif test="%{mode=='modify'}">
            <td><s:submit name="btnSave" value="Save" onclick="onSave()" /></td>
        </s:elseif>
        <td><s:submit name="btnBack" value="Back" onclick="onBack()" /></td>
    </tr>
</table>
<fieldset style="width: 60%"><legend>Details</legend>
<table cellspacing="0" cellpadding="5" width="100%">
    <tr>
        <td><s:label name="ID" value="ID" /></td>
        <td><s:label name="cID" /></td>
    </tr>
    <tr>
        <td><s:label name="Name" value=" Name" /></td>
        <s:if test="%{mode=='view'}">
            <td><s:textfield name="cName" disabled="true" /></td>
        </s:if>
        <s:elseif test="%{mode=='modify'}">
            <td><s:textfield name="cName" id="id2" /></td>
        </s:elseif>
    </tr>
    <tr>
        <td><s:label name="CStatus" value="Status" /></td>
        <s:if test="%{mode=='view'}">
            <td><s:select name="cStatus"
                list="#{'Y':'Active', 'N':'Inactive'}" disabled="true" /></td>
        </s:if>
        <s:elseif test="%{mode=='modify'}">
            <td><s:select name="cStatus"
                list="#{'Y':'Active','N':'Inactive'}" /></td>
        </s:elseif>
    </tr>
</table>
</fieldset>
 </s:form>
 </body>
 </html>

Now my problem is that,
suppose if i have value “xyz” in cName and “Single” in cStatus.
In modify mode i change the values to “xyza” in cName and “Married” in cStatus and submit the form.
In action class i receive the Value Object set as
cName=”xyz, xyza”
cStatus=”Single, Married”
instead of
cName=”xyza”
cStatus=”Married”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:31:16+00:00Added an answer on May 26, 2026 at 5:31 pm

    To resolve this problem i added

     <s:if test="%{mode=='view'}">
     <s:hidden name="cName" />
     <s:hidden name="cStatus" />
     </s:if>
    

    statement to jsp i.e. i am using hidden tag only in view mode. Now in modify mode as both textfield and select tags are enabled, Value Object is automatically set, so there is no need to pass hidden values. Its working now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a screen with a few components (textInput, textArea, checkBox). I want to
It's really simple, I just want one screen. Wow, that [shiny thing] must have
I have a DIV that I want to touch the bottom of the screen
I want a splash screen to show while the application is loading. I have
I have an IE6 absolute position div that I want to be full screen
I still have a problem with the splash screen. I don't want to use
I have a process which gives me continuously output in Screen. I want to
I have a command line program, which outputs logging to the screen. I want
Screen is amazing, of course, but I don't want to have to think about
I have a screen with 2 JSF Input Components : inputText and inputText with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.