Trying to set editor field name to cookie value. Comes up blank..
Trying to set editor field name to cookie value. Comes up blank..
nicoledramirez@hotmail.com
Posts: 60Questions: 14Answers: 2
in Editor
editor.on('initEdit', function getCookie(name) {
var re = new RegExp(name + "=([^;]+)");
var value = re.exec(document.cookie);
return (value != null) ? unescape(value[1]) : null;
var uname = getCookie("myCookie").replace("UserName=", "")
editor.field('User').def(uname);
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
By the time the
initEdit
event occurs the default value has already been read and inserted as the value for the field. If you want to be able to set a value based on the cookie ininitEdit
, usefield().val()
.Allan
Thanks for the response Allan. I tried that too. Still blank.
Could you give me a link to the page so I can check it out please.
Allan
Sorry, but I really can't. Information is confidential. I will see if there is something else I can do tomorrow as an alternative means of sharing.
Resolved this issue can close.