Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 36817 invoked from network); 17 Dec 2009 15:13:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Dec 2009 15:13:41 -0000 Received: (qmail 18063 invoked by uid 500); 17 Dec 2009 15:13:39 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 17980 invoked by uid 500); 17 Dec 2009 15:13:39 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 17970 invoked by uid 99); 17 Dec 2009 15:13:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Dec 2009 15:13:39 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of josorio@euphoriait.com designates 67.222.38.30 as permitted sender) Received: from [67.222.38.30] (HELO outbound-mail-130.bluehost.com) (67.222.38.30) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 17 Dec 2009 15:13:29 +0000 Received: (qmail 20160 invoked by uid 0); 17 Dec 2009 15:13:04 -0000 Received: from unknown (HELO host217.hostmonster.com) (74.220.215.217) by outboundproxy4.bluehost.com with SMTP; 17 Dec 2009 15:13:04 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=euphoriait.com; h=Received:Message-ID:Date:From:Organization:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding:X-Identified-User; b=cb+e781gPeSC+FFQpBUeNGsPqbnUD1FXe8yzAby1roeqbsgm8l0j2RyAy6cO4rEGcOOJ1ZmMAD42tTz47Ff2VhPNYgD8NS8QZYap6W31lB3CNgzuiQHQGgGbBXGukeoy; Received: from [64.76.176.101] (helo=[10.1.103.81]) by host217.hostmonster.com with esmtpa (Exim 4.69) (envelope-from ) id 1NLI2K-0001ZJ-HP for users@myfaces.apache.org; Thu, 17 Dec 2009 08:13:04 -0700 Message-ID: <4B2A48AE.907@euphoriait.com> Date: Thu, 17 Dec 2009 10:05:18 -0500 From: =?UTF-8?B?SnVsacOhbiBPc29yaW8gQW1heWEgRXVwaG9yaWFJVA==?= Organization: EuphoriaIT User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: MyFaces Discussion Subject: Re: How do I change the value of a selectOneMenu on the fly References: <26819601.post@talk.nabble.com> <4B295F39.8070303@euphoriait.com> <26819977.post@talk.nabble.com> <4B296674.1080103@euphoriait.com> <26828813.post@talk.nabble.com> In-Reply-To: <26828813.post@talk.nabble.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Identified-User: {2576:host217.hostmonster.com:euphoria:euphoriait.com} {sentby:smtp auth 64.76.176.101 authed with josorio@euphoriait.com} X-Virus-Checked: Checked by ClamAV on apache.org laredotornado escribió: > Could you show the method of the Javascript submit() function that you are > talking about? I'm having a hard time imagining how what you list is > different than submitting the form. > > Thanks, - Dave > > > > Julián Osorio Amaya EuphoriaIT wrote: > >> laredotornado escribió: >> >>> Thanks, Julian. I have a follow-up question regarding your solution. >>> You >>> include an onchange Javascript handler where you submit the form, at >>> least, >>> I assume that's what submit() does. How do I submit the form, keep it on >>> the same page, preserve the values that were already entered, and not >>> prompt >>> validation? Is it as simple as "this.form.submit();"? >>> >>> Thanks, - Dave >>> >>> >>> >>> Julián Osorio Amaya EuphoriaIT wrote: >>> >>> >>>> laredotornado escribió: >>>> >>>> >>>>> Hi, >>>>> >>>>> I'm using MyFaces 1.1.6 and Tomahawk 1.1.9. I have this selectOneMenu >>>>> ... >>>>> >>>>> >>>> validator="#{historicalTour.validateTime}" styleClass="hourMenu" >>>>> id="historicalTour1st_Preference_Hour" >>>>> value="#{historicalTour.prefs[0].time}"> >>>>> >>>>> >>>>> >>>>> When another text field on the page changes value, I would like to >>>>> re-populate the select menu with new options. I have discovered I just >>>>> can't simply do that with Javascript, because when I submit the form I >>>>> get a >>>>> >>>>> "Value is not a valid option" >>>>> >>>>> error. Any ideas how I can change my select menu options and keep JSF >>>>> happy? >>>>> >>>>> Thanks, - Dave >>>>> >>>>> >>>>> >>>> You can use a Value Change Listener in your text field like this >>>> >>> onchange="submit()" /> >>>> >>>> in your backing bean >>>> >>>> public BackingBean implements ValueChangeListener { >>>> public void processValueChange(ValueChangeEvent valueChangeEvent) { >>>> } >>>> >>>> public void methodName(ValueChangeEvent vce) { >>>> //change your select menu options >>>> } >>>> } >>>> >>>> -- >>>> >>>> >>>> Julian Osorio Amaya >>>> >>>> >>>> >>>> >>>> >>>> >>> >>> >> the function of the javascript event "onchange" is invoke the method in >> the valueChangeListener="#{BackingBean.yourMethod}" >> but it's different from the submit action on > action="#{BackingBean.submitForm}" /> >> >> -- >> >> >> Julian Osorio Amaya >> >> >> >> >> > > there's no body for the submit() function. Do a little test adding this to one of your forms Every time you change the value in the tag there's a submit that invokes the valueChangeListener's method but it's different from a "real" form submit invoked by tag -- Julian Osorio Amaya