Page 1 of 2

Create Cookie for Multiple Fields and then Retrieve on Load

Posted: Mon Feb 25, 2013 5:24 pm
by Ryan Bloom5585665

Hello Tiggzi Support,

I am trying to create a cookie for multiple input fields. The input fields are:

-salespersonName
-salespersonCompany
-salespersonPhone
-salespersonEmail
-salespersonTitle

I am currently trying to set the cookie for just the top field, my code is:

function setCookie(salespersonName) {
document.cookie = salespersonName=Tiggzi('AccessoryAmount').text();
+ "expires=Fri, 16 May 2025 18:40:22 GMT";
alert($.cookie(salespersonName));
}

The alert function is to make sure it is working. When I change the value of the input, I get a pop-up that says [object] [Object].

Any ideas would be much appreciated.


Create Cookie for Multiple Fields and then Retrieve on Load

Posted: Mon Feb 25, 2013 5:54 pm
by Kateryna Grynko

Hello!
Did you connect jQuery plug-in for cookie support?


Create Cookie for Multiple Fields and then Retrieve on Load

Posted: Mon Feb 25, 2013 6:52 pm
by Ryan Bloom5585665

Create Cookie for Multiple Fields and then Retrieve on Load

Posted: Mon Feb 25, 2013 8:52 pm
by Kateryna Grynko

Try replacing:codeTiggzi('AccessoryAmount').text();/code
with:codeTiggzi('AccessoryAmount').val();/code


Create Cookie for Multiple Fields and then Retrieve on Load

Posted: Tue Feb 26, 2013 1:22 am
by Ryan Bloom5585665

No luck. Same pop-up that says [object] [Object].


Create Cookie for Multiple Fields and then Retrieve on Load

Posted: Tue Feb 26, 2013 4:08 am
by maxkatz

Do you have a component named 'AccessoryAmount'?


Create Cookie for Multiple Fields and then Retrieve on Load

Posted: Tue Feb 26, 2013 6:11 am
by Ryan Bloom5585665

Not on this page.


Create Cookie for Multiple Fields and then Retrieve on Load

Posted: Tue Feb 26, 2013 5:13 pm
by maxkatz

Then this will not work:

Tiggzi('AccessoryAmount').text();


Create Cookie for Multiple Fields and then Retrieve on Load

Posted: Tue Feb 26, 2013 5:32 pm
by Ryan Bloom5585665

I had that typo, but after changing it still does not work. My current code is:

function setCookie(salespersonNamecookie) {
document.cookie = salespersonNamecookie=Tiggzi('salespersonName').text();
+ "expires=Fri, 16 May 2025 18:40:22 GMT";
alert($.cookie(salespersonNamecookie));
}


Create Cookie for Multiple Fields and then Retrieve on Load

Posted: Tue Feb 26, 2013 5:40 pm
by maxkatz

You need to debug your code.. put console.log(..) statements and see what values you get.