Copy data to another tab and pdf attachment

laurie 29 Jun, 2012
I have a form that has several tabs. In the first tab is the name of the person. In the last tab there will also be the name of the person. I want to copy the persons name from the first tab to the last tab automatically so the user does not have to fill in the same information twice. What is the best way to achieve this.

Also is there a way to send a form as an pdf email attachment when it is submitted.

Regards
Laurie
GreyHead 29 Jun, 2012
Hi Laurie,

You can do this with a line or two of JavaScript to copy the value from one input to the other.

Max has a PDF action which you can get by asking him using the Contact Us form above. I don't know much about it otherwise.

Bob
laurie 29 Jun, 2012
Hi Bob

Could you give me a clue on the java lines required and where I put them, then hopefully I can stop driving you mad with questions. Well out of my depth with that.

Have emailed max.

Thanks Laurie
GreyHead 01 Jul, 2012
Hi Laurie,

Assuming that your two inputs have the IDs 'input_1' and 'input_2' this script will copy any changes from input_1 to input_2:
window.addEvent('domready', function(){
  $('input_1').addEvent('change', function() {
    $('input_2').value = $('input_1').value;
  });
});

Bob
laurie 01 Jul, 2012
Hi Bob

Thanks for the reply. I added this

window.addEvent('domready', function(){
$('child_name').addEvent('change', function() {
$('childs_name_enrolment').value = $('child_name).value;
});
});

to the On Load Load JS and it removed the tabs from the form and did not change the fields atall.

Have I loaded this in the wrong place ?

Regards
Laurie
GreyHead 01 Jul, 2012
Hi Laurie,

There's a ' missing after childs_name - I updated my earlier post to fix it.

Bob
laurie 01 Jul, 2012
Bob

Your a diamond. That sorted it.

Just out of interest, can you recoment a good place for tutorial info and references to find this sort of information, as it would be nice to try and work this out without drive you crackers for information. Is there a list anywhere for events like the window.addEvent etc.

Thanks again for your help.

Regards
Laurie
GreyHead 02 Jul, 2012
Hi Laurie,

This is JavaScript with some additions from the MooTools library. There are many good JavaScript tutorials on the web W3Schools is where I usually look things up. For the MooTools specific code there are documents at http://mootools.net/docs which I refer to frequently.

There are also various JavaScript validators around that will show up typos like this. I use Sublime Text 2 for coding (though not usually for posting here) which has a 'linter' for checking code.

Bob
This topic is locked and no more replies can be posted.