Retain all form field values after input text field validation failure

Hi,
I have a form with 1 input text field, one Command button and one h:selectManyListbox. when User enteres some values in input field and clicks on command button named Add, the value is validated. If input is invalid, then an error message appears next to the field. If input is valid, then the value is added into h:selectManyListbox. Adding to list box is done using Ajax4Jsf.
Probelm:
Let's assume user entered 3 valid values one after another and all are added into the list box. When he enters a wrong value, and error message appears. however, the entered values in list box goes away. Is there a way to retain the values even after validation failure.
Code is given below;
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<h:panelGroup>
     <h:outputLabel for="inputEmailId1" value="Email Id: " />
     <t:inputText value="#{bean.newEmailId}" id="inputEmailId1" maxlength="100" size="40" immediate="true">
          <t:validateEmail message="Enter a valid Email Id." />
     </t:inputText>
     <t:message for="inputEmailId1" styleClass="errorStyleClass" />
</h:panelGroup>
<t:panelGroup style="text-align: left;" >
     <a4j:commandButton value="Add" styleClass="buttonsSub" action="#{bean.addSharedEmails}"
          reRender="inputEmailId1, selectedSharedEmails" />
</t:panelGroup>
<t:panelGroup style="text-align: left;">
     <h:selectManyListbox id="selectedSharedEmails" size="8" style="width:100%;" immediate="true">
          <f:selectItems value="#{bean.sharedEmails}" />
     </h:selectManyListbox>
</t:panelGroup>
Thanks in advance,

Use the attribute "binding" instead of a "value". This will remember the value. You can also make sure that you dont have anything in your constructor or class level that initialises that value to "" or null. Because if JSF is remembering your value but your initialization that gets triggered before the page loading resets it to default values then you need to change that part of the code.

Similar Messages

  • Can we hide the real value of input text box and show other value in ADF?

    Hi All,
    I have a table in which i have one the column as "Quantity" and text box as "quantity" :-
    <af:column sortProperty="quantity" filterable="true"
    sortable="true" headerText="Quantity" id="c3"
    width="60"
    rendered="#{row.bindings.booleanFlag.inputValue != 'E'}"
    filterFeatures="caseInsensitive">
    <div align="center">
    *<af:inputText value="#{row.bindings.quantity.inputValue}"*
    label="#{bindings.queryProductResponseType.hints.quantity.label}"
    required="#{bindings.queryProductResponseType.hints.quantity.mandatory}"
    columns="#{bindings.queryProductResponseType.hints.quantity.displayWidth}"
    maximumLength="#{bindings.queryProductResponseType.hints.quantity.precision}"
    shortDesc="#{bindings.queryProductResponseType.hints.quantity.tooltip}"
    id="it5" partialTriggers="it19"
    readOnly="#{row.activeYN == 'N'}">
    <f:validator binding="#{row.bindings.quantity.validator}"/>
    <af:validateRegExp pattern="^[1-9]+[0-9]*$"
    messageDetailNoMatch="Quantity must be in whole number format."/>
    </af:inputText>
    </div>
    </af:column>
    Now when the user will enter say 400 in input text box "quantity" , the value should be divided in the same row to other column text box say "conversion" which holds the value as 40 , so if the division doesn't give any remainder(means remainder =0 ) means real value(400/40) = 10 then it should set the value of input text box "quantity" as 10 but the user should be able to see 400 which he/she entered before, as we want to send the 10 as request but we have to show 400 to the user and if remainder goes greater than 1 than it should show an error.
    I have to implement this in value change listener of the text box as i need to calculate the real value each time for a row.
    How should i implement this ?
    Thanks .
    Thanks.

    Thanks timo,
    But can you give me full details how should i implement this as i am newbie to ADF. I have found the data control in Data controls tab in left hand side and right click on it -> edit definition -> but it does not give me the option to add attribute , it just give me the option to edit the existing attribute. Can you explain me how to add the transient attribute and how to implement it ? Any sample code snippet ?
    Thanks.
    Edited by: user13644804 on May 15, 2011 10:09 AM
    Edited by: user13644804 on May 15, 2011 10:09 AM

  • How Can i retain the Shared Variable Values after PC rebooting

    Hi all,
    I am facing a paculiar problem with Shared Variables. I have an application in which shared variables are used for data communication.
    One of the application requirement is to retain the variable values eventhough PC is rebooted or started after crashing. 
    As per the my understanding, the variable values will retain eventhough the PC is rebooted. But here i can observe a paculiar problem like some library variables are retaing the values while some others not. I enabled logging for all the variables.
    I tried many ways. like logging enabled, logging disabled, changing variable names, changing process names etc... But i am not getting a consistent behaviour.
    I hope some you can help me in solving this issue.. "How Can i retain the Shared Variable Values after PC rebooting"
    Thanks and Regards,
    Mir

    Hi Blackperl,
    Thanks for the post and I hope your well. 
    What do you mean by not getting consistent behaviour.. this will all depend on excatly when the crash happens i.e. before the write or after. 
    Surely a better method would be to log the data to a file during the reboot...
    I beleived the value read back
    will be the default value for the shared variable's data type.
    The LabVIEW DSC 8.0 module adds more functionality to the shared variable, including initial values and alarms.
    If you enable an initial value on a shared variable, when the variable
    engine comes back on-line it will default to this value. Setting a bad
    status alarm for the shared variable is also a good way of handling
    this type of event. Additionally, if you are using a LabVIEW Real-Time
    target such as Compact RIO or Compact FieldPoint, it is appropriate to
    consider hosting the shared variable engine on the real-time target.
    These devices have watch-dog capabilities and are typically the
    hardware controlling the critical pieces of an application. Most
    Windows or PC-based targets do not have these fail-safes.
    I guess, if you could explain to me again that would be great. From my point of view, if I have a cRIO and a Windows PC. If the windows PC crashes, the cRIO will still update its shared variables. Then once the PC has started up its own shared variable engine, and the bindings are loaded, it will once again continue to update its copies of the variables.
    Please let me know what you think,
    Kind Regards,
    James.
    Kind Regards
    James Hillman
    Applications Engineer 2008 to 2009 National Instruments UK & Ireland
    Loughborough University UK - 2006 to 2011
    Remember Kudos those who help!

  • Acrobat XI programmatically reset/clear all form fields when opening a PDF form

    I've got a PDF form document that I'm working on.  I'd like to add something to it to programmatically clear or reset all form fields to blank when the document is opened.
    Thoughts/ideas??
    Mucho thanks!!

    You can use the resetForm JavaScript method, either in the initial page's Page Open event or in a document-level JavaScript whic will execute when the document is opened.
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.523.html

  • Extracting all form fields from a fillable pdf

    Is there any way of extracting/exporting/copying all form fields from a pdf? Meaning, the wordings from all the fields so I can pass it along to another individual to use for cross referencing, since they are not able to see all the various form fields within the split screen?
    Thanks!!!

    The person that needs this is looking for the entire running list of all the fillable field names within the pdf. Any kind of document that I can deliver them in, I am willing to take suggestions.
    Right now, what I was thinking of doing was having the screen split between the pdf and the listing of field names in the sidebar and taking screen captures as I scroll down the pdf and corresponding field names in the sidebar until I got all pages.
    Is there an email address I could contact you at to discuss offline? I have an example I could send you but don't want posted online.
    Thanks!

  • List all form fields with JS?

    I imagine this is a pretty easy one, but does anyone know what the script would be to list all form fields in the console?  Specifically, at the moment, I only need it for buttons, but I imagine it would be useful for any fields as well.

    Take a look at the "Required Fields" tool at this site:
    http://www.pdfscripting.com/public/65.cfm
    Its a toolbar button that lists all fields that are required. It could easily be changed to filter for any field parameter, or none.
    Thom Parker
    The source for PDF Scripting Info
    pdfscripting.com
    The Acrobat JavaScript Reference, Use it Early and Often
    http://www.adobe.com/devnet/acrobat/javascript.html
    Then most important JavaScript Development tool in Acrobat
    The Console Window (Video tutorial)
    The Console Window(article)

  • Run button's method action without input text's validation raise

    Hi
    My English isn't very good
    I use jdeveloper 11.1.1.3.0
    I have a button and an inputText(with validation) on the page. I defined a method action for the button.
    when I click the button, the input Text's validation raise and the button's method doesn't run.
    If I set immediate=true for the button then the validation doesn't raise but in this case also button's method doesn't run.
    How can I run button's method action without input text's validation raise?
    Habib

    If I set immediate=true for the button then the validation doesn't raise but in this case also button's method doesn't run.This should have worked . Run your application in debug mdoe and put a debug pointer in your actionListener to see if the control goes there.
    Also put partialSubmit="true" for your button.

  • Trying to auto commit after input text value change

    Hello, I have created a page that contains an input text box. When the user changes something in the input text box, I want to fire off a commit operation.
    As of now, I have valueChangeListener of the inputText set to a method on my managed bean which then grabs the commit operation from my bindings container and executes it.
    At that point, I would expect the changes to a the input text box to be saved after a user modifies it. However, it doesn't seem to be working, because when I refresh the page, the mod I made to the text is not there. The input text still reflects the text that was there before I made a change.
    Anyone know what's happening here?? And how I can make it work?

    Hi Timo,
    Thanks for the response. I tried that, and my commit function in my bean was getting called, but the data still wasnt "REALLY" getting saved.
    I had to bind my input text to a property in managed bean, and call
    inputText.processUpdates(FacesContext.getCurrentInstance());
    doCommit(); // method that simply calls the commit method in my binding container, and does a few other things.
    For simplicity I just bound the panel that all my input components were child of. In this case it was a DecorativeBox. So I bound the DecorativeBox to my bean and just did
    decBox.processUpdates(....)
    doCommit();
    That way all my child input components were updated before the commit took place. That seemed to do the trick nicely (-;
    Edited by: Fonz Desselle on Mar 25, 2013 11:42 AM

  • Help: Text duplicates in all form fields

    When filling in the PDF form fields (of the PDF fillable form that I created), the text duplicates into every other field in the PDF, regardless of which box you type into. Help?

    This is how PDF forms behave if the fields names are the same, so you just need to change their names in Acrobat so they are all different.

  • Value of input text field not changed!

    hi,
    i have a select menu. when i change the value of the select menu, i have the event method and in the event method i change an value of a other input text field, but in the html page, the input text doesn't change his value.
    i bind the input text field to the value field in class with the folowing command.
    <h:inputText binding="#{backing_main_test:testInputField}" value="#{backing_main_test.testValue}"/>
    please help me.
    thanks, christoph

    <h:inputText binding="#{backing_main_test: <--- was that colon intentional?

  • Get value from input text in read only adf table

    all,
    i added a column to an adf read-only table and inserted an input text control in the extra column. how do i loop through the table to get the value from the input field?
    paul

    Hi,
    can you be more clear on the usecase? Its a read only table that you added a input text field in a new column. What is the column based on and what is the goal of looping through ?
    Frank

  • How to change a value of input text box into uppercase?

    Hi all,
    In my use case I should have a text box in the jsf page and I should store the value that is entered in the text box in a database.
    The requirement is the value which user enters in the text box should get changed to Uppercase
    before getting saved in the database. Kindly help me in achieving this.
    Thanks,
    Phanindra.

    hi user,
    before asking any question.
    right place to search anything is google (the ocean).
    so the way. chris showed.
    if i understood correctly means,
    if you want change any input text into uppercase means :
    use some skinning : -
    <af:inputtext>
    contentStyle = "text-transform:uppercase;"
    </af:inputtext>
    Or
    else
    are you looking for
    while given inputtext saved into db.
    Use something like this in as vo for each and ever attribute,
    public void Desc(String value) {
    setAttributeInternal(DESC, value.toUpperCase());
    }

  • Delete all form fields in one go

    Hi
    I am using Acrobat X Pro.
    While running the accessibility check on my PDF, I got an error that there are many form fields that are not tagged to the structure. When I highlighted the fields, I noticed that all these form fields are redundant and can be safely removed. Is there a way I can remove them in one go for the entire PDF document? I saw that there is page-level deletion option where I need to do a Select All and Delete. But how about entire document level?
    Few of my colleagues have Acrobat XI Pro. If this is not possible in X Pro, please let me know we can do it in XI Pro. I can check that out as well.
    Sreekanth

    Go to Form Edit mode, enter the Fields list, press Ctrl+A, then Delete.

  • Reader-enabled form from Acrobat is retaining interactive form fields when user saves the form

    This is an issue that has only recently come up. In the past it was not a problem to take a pdf, add interactive form fields to it in LiveCycle, then open the form in Acrobat and enable usage rights for Reader users.
    This allowed Reader users to fill out the form and save the results. With the most recent versions of Acrobat and Reader the user saves the form and the data AND the interactive form fields are saved in the resulting file - meaning that the data is still there to be changed. Clearly not what we want and not what Acrobat and Reader were doing previously.
    The form does properly display "You can save data typed in this form" when opened in Reader.
    I have got no response to this issue in the LiveCycle forum, and nothing shows up in a search. I would very much like to fix this, as it is affecting our entire library of pdf forms.

    In most instances the form is linked on the website, so the original form will cannot be overwritten.
    In some cases we have to supply an interactive pdf for a department that they will then distribute by email to various groups who are expected to fill the form out on submit on an ongoing basis. That is what I was meaning by the user filling out the form, printing it, and then being prompted to save changes.
    The bigger issue is that most of our users expect to take a form hosted on the website, fill it out, and then save a pdf copy of their responses for reference. The reference copy is retaining the interactive fields rather than printing as a static pdf.
    If I could force the action of printing as a pdf (rather than saving as a pdf) on submission I think that would solve the issue. The script for most of the forms in the library is xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0); and I am not aware of a way to force the print to only be to the pdf print driver.

  • Pass form element value after insert

    I have a page with an insert behaivor, it inserts all form
    elements BUT one,
    I need to pass the value of this form element to the next
    page.
    If I apply the 'insert' behaivor, it does the insert well,
    but the value of
    the form element is not passed to the next page, how can this
    be accomplised
    Aleks

    I can't because the value is entered in the form and there is
    no value until
    it is posted. Remember this is an 'insert page' that then
    redirects to the
    next page.
    I used redirection as:
    <%
    ' *** Insert Record and retrieve autonumber: set variables
    If (CStr(Request("MM_insert")) <> "") Then
    MM_editConnection = MM_eimmigration_STRING
    TM_editTable = "dbo.Users"
    TM_editRedirectUrl =
    "SPLinkFamilymember.asp?FamUserId=Request('relations')"
    Last line has the redirection link.
    but didnt work, I get following error, next page I get this
    value:
    Request('relations')
    Instead of the actual value selected in the form.
    I am using ASP/VB and MS SQL 2000
    A
    "Murray *ACE*" <[email protected]> wrote
    in message
    news:ec821m$df0$[email protected]..
    > By making it a URL parameter? You would arrange that
    when you make the
    > link to the next page.
    >
    > For example -
    >
    > <a href="next-page.php?<?php echo($yourvariable);
    ?>">Next page</a>
    >
    > --
    > Murray --- ICQ 71997575
    > Adobe Community Expert
    > (If you *MUST* email me, don't LAUGH when you do so!)
    > ==================
    >
    http://www.dreamweavermx-templates.com
    - Template Triage!
    >
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    >
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    >
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    > ==================
    >
    >
    > "Alejandro" <[email protected]> wrote in
    message
    > news:ec7p5g$4d3$[email protected]..
    >>I have a page with an insert behaivor, it inserts all
    form elements BUT
    >>one, I need to pass the value of this form element to
    the next page.
    >> If I apply the 'insert' behaivor, it does the insert
    well, but the value
    >> of the form element is not passed to the next page,
    how can this be
    >> accomplised ?
    >>
    >> Aleks
    >>
    >
    >

Maybe you are looking for

  • Problem with iPhone and iPad keyboard shortcuts

    When I try to access the keyboard shortcuts in either my iPhone 6+, iPad 3 or iPad Air, the sequence Settings>General>Keyboard>Shortcuts causes the devices to go back to the Home Screen.  I spent several hours in a chat with Apple Support, had to go

  • How do I delete my iCloud account from an old iPhone

    i upgraded from a 4s to a 6 and need to delete my iCloud account from the 4s, how do I do that?

  • Move Mail from one user to another user on same iMac?

    How do I move my Mail (library and preferences) from one user to another user on the same Imac? This way I want to split afterwards the mailaccounts that now sit in one user over the old and the new user by deleting those mailaccounts that I do not w

  • Document upload in portal

    Hi, We need to upload 2 documents in enterprise portal. The record in the document should be visible to only the specific users. eg: 5 documents for 5 different users . We need to display the documents thru an iview. Please suggest ASAP. Thanks in ad

  • My camera won't work!

    Hello everybody! I just bought my phone yesterday and when i try to take a picture it says this....could not sstart the camera. Closer all other applications and try opening the cmaera again..... well i have absolutly no applications open when it say