Forums

Add a button to down load documents

apandit 12 Feb, 2012
I have a custom form which I have loaded from Kompozer and would like to add the following functionality

Add a button next to the submit button - saying "down Load Form"
When the user presses this a 2 PDFs file on the server should be downloaded to their computer
Message saying click here to return to form.

I would appreciate guidance on this matter and would like to use the core functionality of Chronoengine as much as possible.
GreyHead 12 Feb, 2012
Hi apandit,

There's no special code in ChronoForms to help you build file download links. I did one today that was just a button inside a link tag:
    </div>
    <div class="form_element cf_button" >
    	<a href='index.php?option=com_phocadownload&view=category&download=19:bdc_2012&id=3:info'>
        	<input type='button' name='bdc' value="Resubscribe using our order form" style='width:400px; height:40px;' />
        </a>
    </div>

There's an answer here on StackOverFlow that has a more sophisticated approach for PDFs.

Bob
Max_admin 14 Feb, 2012
Hello,

Another way would be to simply include 2 submit buttons with the same "field name" but different "value" (text) and check the value after the submission using a "Custom server side validation" box or the "Event switcher [GH]" action.

If you will use the "Custom server side validation", then you can use this code inside:

<?php
if($form->data['submit_button_name'] != "Submit"){ //assuming one of the 2 buttons value (text) = "Submit", case sensitive.
return false;
}
?>


And include the "File Downloader" action in the "On Fail" event of the "Custom SSV" action, leave the "on success" empty because this will be the route for normal submissions🙂

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
apandit 15 Feb, 2012
Thanks Grey Head and Max for your response, much appreciated.
apandit 23 Feb, 2012
Feed back!

Both solutions proposed by Max and Bob worked fine.

I have implemented Bobs solution because this by passes the validation of the form.

To see it working use this link http://www.ieyc.de/registration-form.

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