How can I clear the form ?

Hi
I have two input_text field in the form.
<h:input_text id="productid" value="#{productBean.productId" required="true">
</h:input_text>
<h:input_text id="productName" value="#{productBean.productName" required="true">
</h:input_text>
<h:command_button id="search" action="search" value="Search" actionListener="#{productBean.searchDatabase}" type="submit" />
<h:command_button id="clear" action="clear" value="Clear" actionListener="#{productBean.resetResult} " type="submit" />
I don't want clear button to validate the required field. If I change type="reset" then it just reset the form to old values. I need to clear the search results stored in productBean.
Is there any way to invoke the action event with reset button?
Thanks

Hi
I have two input_text field in the form.
<h:input_text id="productid"
value="#{productBean.productId" required="true">
</h:input_text>
<h:input_text id="productName"
value="#{productBean.productName" required="true">
</h:input_text>
<h:command_button id="search" action="search"
value="Search"
actionListener="#{productBean.searchDatabase}"
type="submit" />
<h:command_button id="clear" action="clear"
value="Clear"
actionListener="#{productBean.resetResult} "
type="submit" />
I don't want clear button to validate the required
field. If I change type="reset" then it just reset the
form to old values. I need to clear the search results
stored in productBean.
Is there any way to invoke the action event with reset
button?
Thanks
Leave your "clear" button as type="submit", but add the attribute immediate="true" to it, along with an action expression that points at a method in your backing bean (maybe something like action="#{productBean.clear}") that is implemented like this:
  public Strng clear() {
    setProductId("");
    setProductName("");
    return (null); // Redisplay current page
  }Because of immediate="true", this action will be invoked immediately (that is, in Apply Request Values phase), after which JavaServer Faces will call Render Response phase to redisplay the current page. This bypasses things like validations and the normal search that your "search" button would do.
The same general approach works for "cancel" buttons as well.
Craig McClanahan

Similar Messages

  • How can I clear a form after submitting and saving the data in the iOS Acrobat Reader App

    How can I clear a form after submitting and saving the data in the iOS Acrobat Reader App

    Darrell,
    Thanks for this response. After I posted mine, I saw that the resetForm JavaScript method is documented as being supported starting with version 10.5: http://www.adobe.com/devnet-docs/acrobatetk/tools/Mobile/js.html
    But I haven't been able to get it to work. Can you clarify if support was indeed added and if it works for you?

  • How can i clear the usernames and passwords history from all login websites?

    how can i clear the usernames and passwords in the log in history of the websites? example when i want to login to my facebook i always type first letter of my e-mail and it comes with the passwords because before i put remember my password, and in other websites so, i just need to delete all this login history and it's not working from the clear everything !!! :S any idea please !! thanks in advance :)

    See:
    http://kb.mozillazine.org/Deleting_autocomplete_entries
    http://kb.mozillazine.org/Password_Manager

  • I have forgotten my password and locked my phone, how can i clear the problem

    I have forgotten my password and locked my phone, how can i clear the problem

    By coincidence, this happened to my son just last night.  You do NOT have to restore it to a new phone, but you probably want a current backup.
    Luckily, you can still sync and back it up even if it's locked, so connect it to the computer you usually sync it to. Go to the summary page. It's easiest and fastest to use a local backup, so if iCloud backup is on, turn it off and click "Backup now".  
    After it backs up, either click "Restore iPhone", or
    - hold home and the top button until the screen goes black, release the top and continue to hold the home button until iTunes says "iPhone in recovery mode detected". 
    Follow instructions to restore from backup, and then sync to restore content.  Your phone will come up in an unlocked state. If you have any stuff that was purchased directly to the iPhone (only), you'll have to re-download it. 
    Remember to turn iCloud backups back on if you use them.
    If you don't sync you iPhone to a computer then I *think* those instructions with the buttons will put it into a mode where you can restore it from the cloud (make sure it is NOT connected to a computer while you do this). Otherwise, you will have to restore it as a new phone, then go to settings, reset, then restore it from the cloud.

  • I deleted all my photos and videos and then delete the deleted files but the photo app is still taking up 12 GB of space and I have no room for new stuff.  How can I clear the memory space used by my deleted videos and photos?

    I deleted all my photos and videos and then delete the deleted files but the photo app is still taking up 12 GB of space and I have no room for new stuff.  How can I clear the memory space used by my deleted videos and photos?  I don't know why the photos are still taking up space and if I will have to reset my phone to get rid of the problem.

    Hey there TowneJ,
    Welcome to Apple Support Communities.
    The article linked below provides troubleshooting tips that’ll likely resolve the issue that you’ve described, where deleted files appear to be taking up space on your iPhone 5.
    If you get a "Not enough free space" alert on your iPhone, iPad, or iPod touch - Apple Support
    So long,
    -Jason

  • When I am on my home screen on the iPhone, swipe left to the search page. Put a letter in the search field. then scroll down. eventually you get to all your texts previously deleted or not. The are all there. How can I clear the entire text from the phone

    When I am on my home screen on the iPhone, swipe left to the search page. Put a letter in the search field. then scroll down. eventually you get to all your texts previously deleted or not. The are all there. How can I clear the entire text from the phone

    When I am on my home screen on the iPhone, swipe left to the search page. Put a letter in the search field. then scroll down. eventually you get to all your texts previously deleted or not. The are all there. How can I clear the entire text from the phone

  • How can I clear the stored browsing history in iCloud?

    As the headline says, how can I clear the stored browsing history in iCloud?
    After resetting my iPhone, previous history came back as soon as I signed in with iCloud on it. I would really like this to not occur.

    The only place that Thunderbird gets suggested addresses is from your address books. I have seen some not show up in the books because some key info was never stored when the contact was saved.
    Sometimes you can start a new message and when the bad contact shows up select it. Create the message and save it to drafts. Then you can go to the Draft folder open the draft message by right clicking and select Open Message in Tab. Then click the star to the right of the contact and it will open the contact edit button. From there you can delete the contact.
    This does not always work though.

  • How can I clear the "Purchased" apps?

    How can I clear the "Purchased" apps list from the "Not on This Iphone" list of the Updates section of the App Store on my Iphone 4?
    There is no clear function.  If I Erase All Content and Settings in General Settings will that do it?  It'd be nice not to have to do that and erase all my data and media.

    Nick, you had the right idea.  Success!  I changed my email address on my Apple ID.  Then went to my Iphone and under Settings, iTunes & App Stores, press on AppleID: (I.D.inserted), Sign Out, Create New Apple ID.  Used the original Apple ID email address to create a "new" Apple ID, going through the whole set up process again, including billing info.  Then, when opening the App Store app there are no Purchased apps to display, because there are none on this "new" account.  The old account still exists in Apple cyberspace, but it is not tied to my iPhone or iTunes anymore.  There does not appear to be any way to delete an Apple ID.  Maybe after a few centuries Apple will discard it.  Maybe not.

  • How can I clear the message thatI don't have the latest version?

    Upgraded to v.6.0.1 but always opens in http://www.mozilla.org/en-US/firefox/4.0.1/firstrun/.
    How can I clear the message that this is not the latest version?
    I've uninstalled and reinstalled from fresh download but message still appears. Problem is only on one user account on my laptop - the other is up to date with no error message.

    See these articles for some suggestions:
    * https://support.mozilla.com/kb/Firefox+has+just+updated+tab+shows+each+time+you+start+Firefox
    * https://support.mozilla.com/kb/How+to+set+the+home+page - Firefox supports multiple home pages separated by '|' symbols
    * http://kb.mozillazine.org/Preferences_not_saved

  • How can I clear the history on the maps app on iphone 5 IOS 6.0.2

    How can I clear the history in the maps app that came with iphone5 IOS 6.0.2 ?

    tap the little bookmark(book symbol) on the top right.

  • How can I clear the clipboard?

    Hi.
    I'm working with images, I do different operations with image, after that I'm saving it (the path is the same), and I want to see the new image.
    The problem is that when I create new object the path remain the same, and because of that Java uses clipboard and shows the old image and not the updated.
    So, how can I clear the clipboard?

    Maybe it isn't clipboard but cache?
    so,how can I clear cache?

  • How can I clear the recent document list on the welcome page?

    Have some confidential docs that I don't want to appear when the program is launched. How can I clear the recent document list on the welcome page and the "open recent" list?  thx

    It's not an option in the prefs. It's a hidden file that makes up part of the preference set (as far as I know, most, or all of the seetings you can adjust inside ID's prefences dialog are actually saved in the other half of the set, InDesign Defaults). For more information, see Replace Your Preferences

  • How can I clear the 0.03 on my apple ID?

    Hi, please help, how can I clear the 0.03 on my Apple account? I do not want to buy anything else.

    I assume that you want to change countries ? If you do and you can't spend it then you can try contacting iTunes Support and ask them if they can remove the balance so that you can change countries : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • How can I clear the parallel port?

    I'm sending image-files to a custom made printing unit via VISA through the parallel port.
    Sometimes the unit doesn't accept the file.
    Therefore I need to clear the parrallel port completely and send the file again.
    (Right now I'm switching off the unit and waiting for the error message from WindowsNT).
    How can I clear the parrallel port via LabVIEW?
    (VISA clear.vi doesn't work, the data is still on the port).

    Rainer,
    Maybe you can try the "VISA Flush I/O Buffer" vi (VISA - VISA Advanced -
    Interface Specific). It worked on a serial port, but I have no idea if it
    works
    also on a parallel port. It is worth trying it.
    Good Luck.
    "rainer" schreef in bericht
    news:[email protected]..
    > I'm sending image-files to a custom made printing unit via VISA
    > through the parallel port.
    > Sometimes the unit doesn't accept the file.
    > Therefore I need to clear the parrallel port completely and send the
    > file again.
    > (Right now I'm switching off the unit and waiting for the error
    > message from WindowsNT).
    > How can I clear the parrallel port via LabVIEW?
    > (VISA clear.vi doesn't work, the data is still on the port).

  • How can i clear the preview cache?

    i cant start the software.
    Because i have a error in the preview cache.
    how can i clear the cache?

    Hello milan,
    could you have a look there:
    http://helpx.adobe.com/lightroom/kb/optimize-performance-lightroom.html and >>>
    http://help.adobe.com/en_US/Lightroom/3.0/Using/WS47E8B7F6-16B7-40db-9B3E-2B7D45DCD418.htm l
    Hans-Günter

Maybe you are looking for

  • Ios7 and push notifications and music

    this update is really starting to annoy me now. everytime i go on texts/whatsapp/kik/ anything it tells me to connect my phone to itunes to use push notifications.. so i connected to itunes and got load of songs i didnt want on my phone and no push n

  • Add a new cookie

    Hi all,        I need to add a new cookie that randomly changes for each login attempt. I need to generate different session id before and after the successful authentication. Also every request after the successful authentication should be associate

  • Exchange 2010 cross subnet Dag - Errors creating DB copies in DR site

    We are running exchange 2010 standard edition in our main site with 2 mailbox servers in a DAG. I've added 2 more mailbox servers in a DR site connecting over a 20Mb fiber connection. I've tried adding one of the DR mailbox servers over to the DAG as

  • How to use query in sap tm?

    I have tried to call the query method using service manager instance as shown below CALL METHOD lr_srv_mgr->query      EXPORTING        iv_query_key            = zif_viv_trq_c=>sc_query-root-test_query *     it_filter_key           = lt_filter       

  • Oracle 11i financial  training

    Dear Sir/Madam, IDS Systems Pvt Ltd is authorized to conduct Oracle application functional modules training in association with Oracle University. The courses developed by the Oracle University are aimed at delivering the comprehensive knowledge on c