This topic is locked
[SOLVED]

 Copy one field to another

5/16/2010 6:08:09 AM
PHPRunner General questions
S
swanside author

Hello.

On my Add new page I have two fields.

Job_Description and Contract.
The Contract gets filled in similar to;

Please fix light and boiler in the boiler room on the first floor of the science labs.


The Job Description would be;

Please fix light and boiler in the boiler room on the first floor of the science labs. This has been reported and fixed 5 times in the past and my be an electrical fault. Mr Jones reports a smell of burning.


The Contract is what the customer reports and is a brief description of the fault. This gets shown on an invoice. The Job Description is the full job required, and gets sent to the engineer to fix.
We type in the contract, then we copy and paste the same into the description and add the rest on the end of it.

Is there a java script that will do the following.
Once the text has been typed into the contract, we click in the Job Desciption box and the same text is automatically entered, so we can just add onto the end?
Or, even have a button between the two fields called copy, so by pressing the copy button, it will put the text from one field into the required field?
Cheers

Paul.

A
ann 5/17/2010

Paul,
To fill in the Job Description field automatically proceed to the JavaSCript OnLoad event on the Events tab of the Add/Edit page.

Here is a sample Jvascript API code to add here:

var ctrl1 = Runner.getControl(pageid, 'Contract');

var ctrl2 = Runner.getControl(pageid, 'Job_Description');

ctrl1.on('change',function(e)

{

var value=this.getValue();

ctrl2.setValue(value);

})
S
swanside author 5/18/2010



Paul,
To fill in the Job Description field automatically proceed to the JavaSCript OnLoad event on the Events tab of the Add/Edit page.

Here is a sample Jvascript API code to add here:

var ctrl1 = Runner.getControl(pageid, 'Contract');

var ctrl2 = Runner.getControl(pageid, 'Job_Description');

ctrl1.on('change',function(e)

{

var value=this.getValue();

ctrl2.setValue(value);

})



Thanks Ann, That works Great.

Is there a anyway, I can find out how this code works, and what it means for example, ctrl2? what this is all about?

Thanks

Paul.

A
ann 5/18/2010

Paul,
ctrl1, ctrl2 are controls of the fields "Contract" and "Job_Description".

Here is more information:

http://xlinesoft.com/phprunner/docs/javascript_api.htm

S
swanside author 5/18/2010



Paul,
ctrl1, ctrl2 are controls of the fields "Contract" and "Job_Description".

Here is more information:

http://xlinesoft.com/phprunner/docs/javascript_api.htm


Thats great, Thanks very much Ann.
Paul.