Salesforce Form Validation on Drupal Nodes

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
Krys Freeman's picture

Hi All,

I have a form validation question that I'm hoping someone might be able to help me with.

We are offering a download of a publication - but require that the user offer a bit of lead information in exchange for this document.

The form we will use will be housed on this page: http://www.oursite.com/[url]/download

Salesforce enables form validation via javascript which does not allow the end user to go to the completion page without filling out all of the inputs: http://bit.ly/e201Zo

And when the form is complete, users will be directed to this URL, which will contain a link to the .pdf file: http://www.oursite.com/[url]/download/[static-url]

We wanted to know if you could help on one important question:

Is there a way to ensure that an end user who for some reason arrives on the latter page (/[static-url]) without completing the form is prohibited from accessing the download?

Or is there a way to make the url disguised such that it not discernable/shareable?

Comments

Token

Session key

cduwe's picture

Hi,

I've done this by adding a session key as part of the submit hook. Only clients with a valid session key can view webform thank-you page that has the link to the file. (This also hooks into SF and tracks which file they downloaded and sends that off to SF too)

Colin

Not using the Webform Module

Krys Freeman's picture

Hi Nancy, Hi Colin:

Thanks for your replies - I took a look.

@Nancy: If I understand your suggestion this - I would add the code listed:

<?php
function drupal_get_token($value = '[myvalue]') {
 
$private_key = drupal_get_private_key([mykey]);
  return
md5(session_id() . $value . $private_key);
}
?>

... to the actual node I am working on, or somewhere else?

And was this response specific to a node generated by the webform module?

@Colin:
I'm not actually using the webform module for this, I was going to create two nodes and build the forms from a set of salesforce form inputs, with their javascript form validation code.

Assuming implementing a hook would require a much more intensive rigging, no?

Krys Freeman
Web Project Manager
GreenBiz Group Inc

Seeking a Drupal Devloper for contract projects. Interested? [Apply Today]