How to use cookies in detail view

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
ppfoong
Posts: 5
Joined: 2021-07-13 16:46

How to use cookies in detail view

Post by ppfoong » 2021-10-29 02:35

I am trying to make an event sign-up form with AppGini to replace the use of Google Form for the same purpose.

I have followed the tutorial to enable visitors to create new record without the need of having a login account. That works great.

Now, I am trying to make it a little bit more convenient for the sign-up user, so that when he/she come back again for another event, info such as name, email, phone number, company name, job title, etc. can be auto-filled up in the sign-up form, instead of getting the user to repeatedly key-in the same piece of information everytime.

I know Google Chrome has such a feature to "remember" form data and let the user select input from previous data, but that still requires the traverse through every input field, select the data, and might need to do minor editing too. I want to make it more convenient.

What I try to make is to auto-fill the fields with previously input data, and add in a "Clear" button in case the user want to key-in a new set of data for another person's detail.

I have evaluated a few approaches to achieve this:

a) Let the user create a guest level account, store the info in his/her account, and auto-post the info into the sign-up form.

However, this will introduce another inconvenience for users who only want to attend a single event.

b) Using cookies to store those information, and auto-post the info into the sign-up form.

I think I can store the cookies using after_insert function, and load the cookies into variables, if they exist, using init function.

My question is: after loading the cookies information, how to set them as default value to the input fields, including text field, dropdown selection, radio button?

Do I need to use jquery? Any sample codes available?

Thank you.

Post Reply