How can call cookies in servoy

Questions and answers for designing and implementing forms in Servoy

How can call cookies in servoy

Postby vimal.kr.pathak » Mon Aug 06, 2012 9:08 pm

Hi,

I am creating some cookies in velocity report using javascript function ---

function setCookie(c_name,value,exdays){
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}

function loginSubmit(){
setCookie("userId",document.getElementById("userID").value,365);
setCookie("pwd",document.getElementById("pwd").value,365);
setCookie("serverName",document.getElementById("serverName").value,365);
}

and I want to call these cookies in servoy.

I am using Servory 5.2.13 and I can not update it with latest version of servoy.

How can do it?

Please help me. :(
vimal.kr.pathak
 
Posts: 2
Joined: Thu May 17, 2012 7:43 pm

Re: How can call cookies in servoy

Postby ptalbot » Mon Aug 06, 2012 10:47 pm

What do you mean you set cookies in VelocityReports? There's no support for cookies in VelocityReports, unless you are talking about the Velocity web client? In which case you get these cookies from the vr_getContext(request) function, in the request object, as request.cookies. But I'm not sure what you are trying to do there, what is document?
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1654
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: How can call cookies in servoy

Postby vimal.kr.pathak » Tue Aug 07, 2012 6:18 pm

Yes, I am using request.cookies to find all cookies and request.cookies.pwd return details of cookies through “pwd” key but request.cookies.pwd.value return undefined.

How can find value of key “pwd”?

I am using Servory 5.2.13 and I can not update it with latest version of servoy.

and

In JsLib, Json is not exist in Servoy 5.2.13, it exist in servoy 6.0.
Attachments
CookiesProblem.png
CookiesProblem.png (22.36 KiB) Viewed 3344 times
vimal.kr.pathak
 
Posts: 2
Joined: Thu May 17, 2012 7:43 pm

Re: How can call cookies in servoy

Postby ptalbot » Tue Aug 07, 2012 7:07 pm

Ah! Good one. The cookie, which is a subtype of the Velocity plugin, and an object on it's own, was wrapped in a context that didn't understand it during its instanciation: the result was that the toString() method was present (what you see when you output request.cookies.pwd), but the inner js_getXXX methods were not recognized... I'll update the plugin in a bit. This will fix your issue.
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1654
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC

Re: How can call cookies in servoy

Postby ptalbot » Tue Aug 07, 2012 7:16 pm

Fixed in v2.0.11, please update.
Patrick Talbot
Freelance - Open Source - Servoy Valued Professional
https://www.servoyforge.net
Velocity rules! If you don't use it, you don't know what you're missing!
User avatar
ptalbot
 
Posts: 1654
Joined: Wed Mar 11, 2009 5:13 am
Location: Montreal, QC


Return to Forms

Who is online

Users browsing this forum: Google [Bot] and 7 guests

cron