# Set value of one text field from another

**URL:** <https://www.ruby-forum.com/t/set-value-of-one-text-field-from-another/128842>\
**Category:** FXRuby\
**Created:** [February 12, 2008, 2:13am UTC](https://www.ruby-forum.com/t/set-value-of-one-text-field-from-another/128842 "2008-02-12T02:13:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![woodzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/f08c70/32.png) [@woodzer](https://www.ruby-forum.com/u/woodzer)\
**Post date:** [February 12, 2008, 2:13am UTC](https://www.ruby-forum.com/t/set-value-of-one-text-field-from-another/128842/1 "2008-02-12T02:13:23Z")

</div>

I have 2 FXTextFields with data targets for the string values in each. I  
would like to set the value of the second field to the value of the  
first 10 characters in the first field if it is empty. Can anyone  
suggest a way I might achieve this. I would also like to limit the  
second field to a max of 10 characters and ensure that they are all in  
uppercase. Any help or pointers would be appreciated.

In case it helps, here is a snippet of the code I currently have:

@desc = FXDataTarget.new("")  
@sname = FXDataTarget.new("")

FXLabel.new(matrix, “&Description”, nil,  
LAYOUT\_CENTER\_Y|LAYOUT\_CENTER\_X|JUSTIFY\_RIGHT|LAYOUT\_FILL\_ROW)  
txtDesc = FXTextField.new(matrix, 50, @desc, FXDataTarget::ID\_VALUE)

FXLabel.new(matrix, “&Short Name”, nil,  
LAYOUT\_CENTER\_Y|LAYOUT\_CENTER\_X|JUSTIFY\_RIGHT|LAYOUT\_FILL\_ROW)  
txtSname = FXTextField.new(matrix, 10, @sname, FXDataTarget::ID\_VALUE)

---

<div class="post-metadata">

**Author:** ![woodzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/f08c70/32.png) [@woodzer](https://www.ruby-forum.com/u/woodzer)\
**Post date:** [June 4, 2009, 8:58am UTC](https://www.ruby-forum.com/t/set-value-of-one-text-field-from-another/128842/2 "2009-06-04T08:58:17Z")

</div>

Very interested too, not only two FXTextFields objects, for more.

---

<div class="post-metadata">

**Author:** ![woodzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/f08c70/32.png) [@woodzer](https://www.ruby-forum.com/u/woodzer)\
**Post date:** [September 2, 2010, 10:59am UTC](https://www.ruby-forum.com/t/set-value-of-one-text-field-from-another/128842/3 "2010-09-02T10:59:12Z")

</div>

Hi  
Thanks for sharing with such great information actually I am little bit  
week in programming language thatâ€™s why difficult for me to completely  
understand your forum but your overall forum is nice.  
thanks  
recoverydata

> **[Data Recovery software | recover deleted windows partition hard disk files...](https://www.datadoctor.biz/)**
>
> Data recovery software recover windows hard disk drive deleted formatted partition retrieve usb pen drive files unformat ipod digital camera memory stick pictures images photo SD Xd flash card unerase utilities tools crashed laptop FAT NTFS drives...
