Design and CSS styles
Version 5.x > Design and CSS styles > Form pop up when selected download View modes: 
User avatar
Member
Member
gsvencionis-millennialnet - 3/9/2011 8:59:59 AM
   
Form pop up when selected download
Hi,
I need some help with setting up connecting form to the link. On my current site which does not run on kentico when customer clicks to download pdf, form pop up to collect his name and email. Once he submits the form, pdf become available.

How can I set it up on kentico? I build the form, but having hard time finding the way to connect it to the link and the document.

Thanks,

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 3/16/2011 7:39:36 AM
   
RE:Form pop up when selected download
Hello,

The easiest way how to do this is to create a page where this BizForm is located. You can list somewhere the specified pdf and link to this page instead of to the file directly and supply the id of the file in a query parameter (e.g. the GUID). After the user fills out the form, you can redirect him to the file.

Or you can modify the ~\CMSPages\GetFile.aspx.cs file to filter out the pdf files and handle them differently (e.g. with redirection to the page with the BizForm).

Best regards,
Boris Pocatko

User avatar
Member
Member
gsvencionis-millennialnet - 3/17/2011 9:55:22 AM
   
RE:Form pop up when selected download
Hi Boris,

Thanks a lot for your response! I believe I do need some more help…

I created the page with the form in it. I also have few pages with links to pdfs. How exactly I use the id of the file in a query parameter (GUID)? And how do I redirect to the file once the from is filled out?

Thanks,

Giedrius

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 3/23/2011 10:04:05 AM
   
RE:Form pop up when selected download
Hello,

You can define a OnAfterSave method, which is triggered after the BizForm is saved (the bizform web part is located in the CMSWebParts\BizForms\bizform.ascx.cs file):

For example:

protected void viewBiz_OnAfterSave()
{

//...here you can use the ResponseRedirect(Url) method

}

To get the URL you can create links in the following format:

www.mydomain.com/bizformpage?id=PDF_id

In your case can the PDF_id be the GUID of the file from the system. To get this id you can either create a database query for it (it's located in the CMS_Attachment table under the AttachmentGUID column) or you can use the CMS.FileManager.AttachmentManager (our API reference can be found here). Creating a link to the file should help this documentation.

If you need help with anything else, please let me know on which part you need more information.

Best regards,
Boris Pocatko