I am trying to find a way of pre populating the certificate field in the following quick form.
![XeroConnect-cert-copy-paste.png](http://i.imgur.com/enN7ei3.png)
Is there some way of setting this field (textarea) with an initial value before form validation?
My code is as follows:
<?php
//ini_set( 'error_reporting', E_ALL );
//ini_set( 'display_errors', true );
defined("_VALID_ACCESS") || die('Direct access forbidden'); // - security feature
class Custom_XeroConnect extends Module { // - notice how the class name represents its path
public function body() { // - modules main code
//print('Xero Connect');
$form = $this->init_module('Libs/QuickForm');
$form->addElement('header', 'title', __('Xero Connect'));
$form->addElement('text','consumer_key',__('Consumer Key'),array('style'=>'width:250px'));
$form->addElement('text','secret_key',__('Secret Key'), array('style'=>'width:250px'));
$form->addElement('submit', 'button', __('Save'), $form->get_submit_form_href());
$form->addElement('header', 'subtitle1', __('X509 Certificate'));
$form->addElement('textarea', 'key_txt', null, array('style'=>'height:100px;width:250px'));
$msg = '<div style="width:250px">Copy and paste this certificate to your Xero Dashboard to generate your consumer and secret keys.</div>';
$form->addElement('static', 'static_text_1', '', $msg);
$form->addElement('button', 'cert_btn', __('Generate New Certificate'), $form->get_submit_form_href());
if ($form->validate()) {
$values = $form->exportValues();
var_dump($values);
$local = $this->get_data_dir();
var_dump($local);
}
$form->display();
}
public function get_x509_keys() {
}
}
?>
Regards
Glenn