This topic is locked

Repeating Parts of Information In Other Fields

4/25/2009 8:57:20 AM
PHPRunner General questions
N
nitro23456 author

Hi
I have a database consisting of 4 fields.
If I typed 'abcdefghijklmnop' into Field1, I would like some of the characters to repeat in the other 3 fields.
E.g.
Field1: abcdefghijklmnop
Field2: abcdef

Field3: ghijkl

Field4: mnop
Can this be done in 'realtime', so that as I type into field1 I see the other fields filling in? Also how do I adjust what characters are shown in each field - I may want the first 10 characters in Field2 for example (even though my example above shows 6).

J
Jane 4/27/2009

Hi,
to fill another fields on the fly use custom JavaScript code.

You can add this code at the end of page on theVisual Editor tab in HTML mode.

Here is just a sample:

<script>

document.forms.editform.value_FieldName.onchange = function()

{

field1 = document.forms.editform.value_FieldName1.value;

document.forms.editform.value_FieldName2.value = field1.substr(10);

}

</script>


More info here:

http://www.w3schools.com/jsref/jsref_obj_string.asp