Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 93868 invoked from network); 29 Jul 2004 15:40:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 29 Jul 2004 15:40:06 -0000 Received: (qmail 2487 invoked by uid 500); 29 Jul 2004 15:39:49 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 2389 invoked by uid 500); 29 Jul 2004 15:39:49 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: users@cocoon.apache.org Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 2370 invoked by uid 99); 29 Jul 2004 15:39:48 -0000 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=DATE_IN_FUTURE_03_06,DNS_FROM_RFC_POST X-Spam-Check-By: apache.org Received: from [65.54.186.191] (HELO hotmail.com) (65.54.186.191) by apache.org (qpsmtpd/0.27.1) with ESMTP; Thu, 29 Jul 2004 08:39:42 -0700 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 29 Jul 2004 08:39:40 -0700 Received: from 128.6.76.190 by bay16-dav11.bay16.hotmail.com with DAV; Thu, 29 Jul 2004 15:39:40 +0000 X-Originating-IP: [128.6.76.190] X-Originating-Email: [lechaelnah@hotmail.com] X-Sender: lechaelnah@hotmail.com From: "Christina" To: References: <41082A8D.90501@anu.edu.au> Subject: Re: [CForm] how to setValue for a field of selection list? Date: Thu, 29 Jul 2004 11:41:01 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: X-OriginalArrivalTime: 29 Jul 2004 15:39:40.0834 (UTC) FILETIME=[434A0820:01C47582] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Scott, I used the widget.setValue("selectedValue"), but what's shown in the form is still the default value. this setValue works for other fields, but obviously it doesn't work for fields with a selection list Thanks Christina ----- Original Message ----- From: "Scott Yeadon" To: Sent: Wednesday, July 28, 2004 3:37 PM Subject: Re: [CForm] how to setValue for a field of selection list? > Christina, > > If you're saving the last selected value to a database and want to set > the value to what the user selected last save, you need to be able to > indicate which value was last selected, either via database field, XML > attribute (if an XML database), or preferences file, or some other > mechanism. If you know what was last selected you can then use the > setValue call. > > Scott. > > Christina wrote: > > >No, I mean the selection list is already there. > >What I want to do is to select a value from the list and show it on the > >page, instead of the default value every time. > >for example, > >at first use select a value and save it. when he access this page again, I > >fetch the value from db and set the value to that droplist. > >user can select another value if he want to change it. > > > >----- Original Message ----- > >From: "Stephane Delort" > >To: > >Sent: Wednesday, July 28, 2004 1:16 AM > >Subject: Re: [CForm] how to setValue for a field of selection list? > > > > > > > > > >>Hi Christina, > >> > >>maybe you should take a look at the "setSelectionList" function. > >> > >> > >>here is a sample of code I use to fill mine (as javascript in a cform > >>template): > >> > >>var langWidget = event.source.lookupWidget("../lang"); > >>size = 10; > >>for( var i=1; i < size; i++) { > >> data.lang[i] = {value: languages.getValue(i), label: > >> > >> > >languages.getLabel(i)}; > > > > > >>} > >> langWidget.setSelectionList(data.lang, "value", "label"); > >> > >>//languages is an home made java class > >> > >> > >>hope this help, > >>Stephane > >> > >> > >> > >>--------------------------------------------------------------------- > >>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > >>For additional commands, e-mail: users-help@cocoon.apache.org > >> > >> > >> > >> > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > >For additional commands, e-mail: users-help@cocoon.apache.org > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > For additional commands, e-mail: users-help@cocoon.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org