CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Copy one object value into another in CCS

Print topic Send  topic

Author Message
Rene
Posted: 07/03/2002, 8:39 AM

Can somebody help me with the proper syntax to copy the value of one input field into another?...

I'm creating a record form in CCS with several columns of input fields. The first column of fields is labled Side1 and the second column is labeled Side2. 90% of the time, whatever a user inputs into the side1 fields they'll also input into the equivalent side2 fields, so I'd like to create a button with a Server Onclick event which copies the value in one set of input fields into another. Basically, copy formname.field1.value to formname.field2. Can anybody offer some guidance?
rbaldwin
Posted: 07/03/2002, 10:23 AM

I think it makes more sense to do it on the client via javascript? This way there is no server/database action till after the value of field2 gets set from the value of field1 and the user can still change field2 before clicking on submit. hope this helps

Rod.

<SCRIPT language=javascript>
function field1OnChange()
{
document.formname.field2.value = document.formname.field1.value
}
</SCRIPT>
....
<Form name=formname>
<input type=text name=field1 onChange="field1OnChange()">
<input type=text name=field2 >
</Form>
Rene
Posted: 07/03/2002, 1:57 PM

Rod, thanks for the suggestion. Stupid question maybe but I'm new to all this stuff and I don't know much about Java. Would you assign the Java script to a client-side on-click event, so that when the user clicked on a button the code would execute on the client? Or... would you place this code at the top of the form and then would Java automatically copy the value in field1 to the field2 as the user typed the values in?
rbaldwin
Posted: 07/04/2002, 8:20 AM

actually java and javascript are two separate things.

I've not done this myself yet but, if you click on field1 in the project explorer, then in the properties window events tab, under client add onChange Action of type "Custom Code". CCs will then display where you need to add my suggestion.

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.