Using "seen" on a trail in KRL -


i want have trail helps keep track of values want persist users. if user has not entered name, want display form them enter name use lookups.

i want able check if name on trail. if name on trail display data user. if name not on trail want display form them enter name.

i looking on how accomplish this. suggested encode struct json , pushing on trail , search it. direction on how done helpful. use following?

if seen ent:user_data <regexp> {    <get , show data> } else {    <show form user> } 

if want save simple string later can following using entity variable

in pre block retrieve saved name entity variable:

savedname =  ent:username || ""; 

in postlude save or clear entity variable:

set ent:username username; clear ent:username; 

example app => https://gist.github.com/722849

example bookmarklet => http://mikegrace.s3.amazonaws.com/forums/stack-overflow/example-persistant-trail-bookmarklet.html

example run on http://example.com results

  • first run on example.com

first run on example.com

  • after clicking submit

after clicking submit

  • reloading page , running app again

running app again after roload

  • clearing trail running on yahoo.com

alt text

  • running app on yahoo.com before saving name or after clearing

alt text

note: when want save else age, can use different entity variable

ent:userage 

the sky limit. ; )


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -