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

From: Date: Fri, 01 Nov 2002 13:50:36 +0000
Subject: Re: [SMARTY] Automatic update of textfield when users uses <select>
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6079@lists.php.net to get a copy of this message
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 2. Anything to do with PHP ? 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 and you don't need to create a function for that, just add it to the onChange event of the <select> tag. Bertrand

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