Forums

Can Chronoform preload data from webaddress?

ledyr 15 May, 2012
Hello!
I read that Chronoform can get info from DB in an other topicm.

However i wounder if it is possible to get feilds preloaded with data from the web address that will be created in on other software?

/Henrik
GreyHead 15 May, 2012
Hi Henrik,

Possibly, how will you pass the data to the ChronoForm?

Bob
ledyr 15 May, 2012
What i hade in mind is that on my PDF invoices i could do a link to the form with the reference no filled in and even perhaps the custumer name.
GreyHead 16 May, 2012
Hi ledyr,

If you add an identifier to the embedded link e.g. the invoice number &inv=x9999y then you can use the ChronoForms DB Record Loader to recover any related information.

Bob
ledyr 12 Oct, 2012
ok, do i understand right if i then need to have the information stored in the db already to pull information?

or is it possible to make a dynamic webaddress that could contain custumer name and invoice no for example?

Henrik
GreyHead 12 Oct, 2012
Hi Henrik,

Sure you can include the information in the URL. It probably needs to be URLencoded to work correctly (there are some characters that can't be included in URLs). I'd probably think about base64 encoding it to - that just gives a long, random looking string.

Bob
GreyHead 12 Oct, 2012
Hi ledyr,

If you try the url
http://www.2rent.se/08-7020222/jupgrade/index.php/bud-foerfragan?input_text_25=9999

You will see that the value 9999 appears in the 'Märkning av budet' input.

If you try
http://www.2rent.se/08-7020222/jupgrade/index.php/bud-foerfragan?bnamn=greyhead&input_text_25=9999
you will see that two inputs are filled

[attachment=0]12-10-2012 18-24-11.png[/attachment]

In practice I would change the input name to something more useful, maybe 'markning' then the URL would be
http://www.2rent.se/08-7020222/jupgrade/index.php/bud-foerfragan?markning=9999


Bob
ledyr 12 Oct, 2012
THANK YOU! This is awsome!
I will now start to generate QR codes that will make pre-filled in forms!

Henrik
GreyHead 12 Oct, 2012
Hi henrik,

If you need it I have a QR library running in a ChronoForms somewhere on a test form.

Bob
ledyr 16 Oct, 2012
ah, that would be great to look at!

/henrik
GreyHead 16 Oct, 2012
Hi Henrik,

Here's the code the creates the QR code. I used the PHP QR Code library from here as the Google code is now deprecated.

This example builds QR code based on the current Username and adds the URL and the QR image URL into the $form->data array for later use:
<?php
$user =& JFactory::getUser($form->data['user_id']);
$form->data['url'] = JURI::root().'index.php/'.$user->username;
$cf_path = JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS;
include $cf_path.'includes/phpqrcode/qrlib.php';
$qr_code_path = $cf_path.'uploads'.DS.'qrcodes'.DS.$user->username.'.png';
QRcode::png($form->data['url'], $qr_code_path, 'L', 4, 2);
$qr_code_url = JURI::root()."components/com_chronoforms/uploads/qrcodes/{$user->username}.png";
echo "<div><img src='{$qr_code_url}' /></div>";
echo "<div style='border: 1px solid silver; padding:6px;' >URL: {$form->data['url']}</div>";
$form->data['qrcode'] = $qr_code_url;
?>

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