Re: [SMARTY] Automatic update of textfield when users uses <select>

From: Date: Wed, 02 Oct 2002 13:07:20 +0000
Subject: Re: [SMARTY] Automatic update of textfield when users uses <select>
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6080@lists.php.net to get a copy of this message
On Fri, Nov 01, 2002 at 02:50:36PM +0100, Bertrand DUNOGIER wrote: > PVW> I'm trying to find out if it is possible to set the value of a text > PVW> field when the user chooses something from a dropdown box(OnChange) > PVW> in perfect conditions it will look a bit like this: > > PVW> <SCRIPT LANGUAGE="javaScript"> > PVW> {literal} > PVW> function Update_Email() { > PVW> document.txtEmail.value = > PVW> {/literal}{$customer[{literal}document.selCustomer.selectedIndex{/literal}].email}; > PVW> } > PVW> </SCRIPT> > > Several questions... > > 1. What does it have to do with Smarty ? Except the fact that it is > located in a Smarty template of course I will try to be more clear about it: i have dropdownbox on my template which contains the data from $customer.name and is indexed by $customer.id when the user chooses a name from the box the "document.selCustomer.selectedIndex" has the right index which corresponds with the customer selected. What i want now is that document.txtEmail.value contains the value which can be found in $customer[here should the index come].email > 3. About your question, it looks like you're missing something in your > line: the correct syntax (without the variables, you can set them > yourself) woule be: > document.txtEmail.value = > document.txtEmail.selectName[document.txtEmail.selectedIndex].value my syntax is right(not completly but, if it were it should work :() i have a box called "selCustomer" where the user can select a customer. When the user has selected the customer the email adress which comes witht the selected customer should be filled in "txtEmail"

« previous php.smarty.general (#6080) next »