• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to send email with the link that has user id?

Community Beginner ,
Jan 18, 2016 Jan 18, 2016

Copy link to clipboard

Copied

Hello everyone, I'm trying to send email with the link that includes user id. After users click on the link they should be able to see the form with their information that has been previously filled. So my question is after I send the email how and what is the best way to pull information and show them to user. Should that be separate page with the cfquery limited on user id or something else? If anyone has any idea what is the best way to do this please let me know. I already have my code that send emails.

Views

647

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Jan 19, 2016 Jan 19, 2016

Are you saving all of the initially submitted fields to a database?  If so, perform a query and then output the query values to the form field. I don't know what your data (or database) looks like, but a simplified version could look something like this.

<CFQUERY NAME="GetForm" DATASOURCE="MyDB">SELECT FirstName

FROM SavedFormTable

WHERE ID = <cfqueryparam value="#URL.ID#" cfsqltype="CF_SQL_INTEGER"></CFQUERY>

<CFOUTPUT QUERY="GetForm">

<form action="">

<input type="text" name="FirstName" value="#HTML

...

Votes

Translate

Translate
Enthusiast ,
Jan 18, 2016 Jan 18, 2016

Copy link to clipboard

Copied

What is the format of the user id?  Is it a number?  If so, you could use the ColdFusion Hashids CFC to salt+generate a unique ID to use in a URL:

http://hashids.org/coldfusion/

You could then attempt to parse the hashIds back into a number and, if possible, allow them to edit the associated record that matches the ID.

Another option would be to generate a random hash and store it in database w/information regarding the update form and user id.  After the link is clicked, log the date so that the link is disabled and can't be used again.

The return page should use SSL and potentially require them to log in (depending upon the sensitivity of the data that will be updated.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 18, 2016 Jan 18, 2016

Copy link to clipboard

Copied

What is the best way to retrieve information after user click on the link? First step will be to decrypt the ID(yes it is a number) and then pull the information with cfquery or ? I'm trying to think what is the best and most efficient way of doing this. Thank you for help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 19, 2016 Jan 19, 2016

Copy link to clipboard

Copied

I'm not sure I understand your question.  What do you mean by the "best and most efficient way"?   What are you specifically requesting assistance on? (Your question is somewhat vague.)

  • How to perform a SQL SELECT query using ColdFusion?
  • How to create an HTML-based form and pre-populate it with query data?
  • How to post data from a form back to the server?
  • How to perform a SQL UPDATE query using ColdFusion?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 19, 2016 Jan 19, 2016

Copy link to clipboard

Copied

I already have a form where user enter all information and after they click submit they receive the link. If they click on the link I want to use the same form and populate all fields with user info. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 19, 2016 Jan 19, 2016

Copy link to clipboard

Copied

LATEST

Are you saving all of the initially submitted fields to a database?  If so, perform a query and then output the query values to the form field. I don't know what your data (or database) looks like, but a simplified version could look something like this.

<CFQUERY NAME="GetForm" DATASOURCE="MyDB">SELECT FirstName

FROM SavedFormTable

WHERE ID = <cfqueryparam value="#URL.ID#" cfsqltype="CF_SQL_INTEGER"></CFQUERY>

<CFOUTPUT QUERY="GetForm">

<form action="">

<input type="text" name="FirstName" value="#HTMLEditFormat(FirstName)#">

<input type="submit">

</form>

</CFOUTPUT>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation