Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
passing hash cookie values
-
- Posts: 114
- Joined: Sun Sep 29, 2019 12:40 pm
passing hash cookie values
I have 2 inputs on a form start_date and end_date. They are to be used to change the select SQL on the before edit PHP of the form
onchange for start_date which is a nudate format yyyy/mm/dd
var y =$(this) val(0);
nuSetProperty('start_date',y);
onchange for end_date which is a nudate format yyyy/mm/dd
var z =$(this) val(0);
nuSetProperty('end_date',z);
At the start of before edit I have
$start_date=#start_date#;
$end_date=#end_date#;
If I debug the dates I get nothing.
Am I doing something obviously wrong?
How do I check the values held in y and start_date in the onchange for start_date?
Many thanks
onchange for start_date which is a nudate format yyyy/mm/dd
var y =$(this) val(0);
nuSetProperty('start_date',y);
onchange for end_date which is a nudate format yyyy/mm/dd
var z =$(this) val(0);
nuSetProperty('end_date',z);
At the start of before edit I have
$start_date=#start_date#;
$end_date=#end_date#;
If I debug the dates I get nothing.
Am I doing something obviously wrong?
How do I check the values held in y and start_date in the onchange for start_date?
Many thanks
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: passing hash cookie values
Try using a global Hash Cookie by passing true as 3rd parameter:
Code: Select all
nuSetProperty('start_date',y, true);
-
- Posts: 114
- Joined: Sun Sep 29, 2019 12:40 pm
Re: passing hash cookie values
Thanks Kevin. Tried that and no difference.
My input is a nudate yyyy-mm-dd. I am using
onchange for start_date which is a nudate format yyyy/mm/dd
var y =$(this) val(0);
nuSetProperty('start_date',y);
For example. I use the selector and choose 2021-01-01
How do I see the value of y before the nuSetProperty? Is y held as an internal date format? Is is held as a string 2021-01-01?
How do I see the value of hash cookie start-date ?
In my Before Edit I need to end up with a string '2021-01-01' to make the WHERE element of my SQL work. Should I manipulate the hash cookie in the js element or in the PHP element?
If I use Date-time local can I create the hash cookie to only use the YYYY MM DD elements?
I have been trying all of these but I just do not seem to end up with anything in my hash cookie. I will keep trying
My input is a nudate yyyy-mm-dd. I am using
onchange for start_date which is a nudate format yyyy/mm/dd
var y =$(this) val(0);
nuSetProperty('start_date',y);
For example. I use the selector and choose 2021-01-01
How do I see the value of y before the nuSetProperty? Is y held as an internal date format? Is is held as a string 2021-01-01?
How do I see the value of hash cookie start-date ?
In my Before Edit I need to end up with a string '2021-01-01' to make the WHERE element of my SQL work. Should I manipulate the hash cookie in the js element or in the PHP element?
If I use Date-time local can I create the hash cookie to only use the YYYY MM DD elements?
I have been trying all of these but I just do not seem to end up with anything in my hash cookie. I will keep trying
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: passing hash cookie values
Replace / with -
Code: Select all
var y =$(this).val().replaceAll('/','-');
nuSetProperty('start_date',y, true);
-
- Posts: 114
- Joined: Sun Sep 29, 2019 12:40 pm
Re: passing hash cookie values
Kevin - tried this. I am now getting something when I debug.
I choose 2021-01-01 on my input.
In Before edit I debug the variable $sd which is set by $sd=#start_date#
Debug value 2019
Is there a problem with date format, UTC / local ?
I choose 2021-01-01 on my input.
In Before edit I debug the variable $sd which is set by $sd=#start_date#
Debug value 2019
Is there a problem with date format, UTC / local ?
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: passing hash cookie values
I think I don't fully understand your setup.
I tested it with an input (format yyyy-mm-dd) and set the hash cookie when the onblur event occurs.
Then in Before Browse I retrieve its value and then in the nuDebug Results I see the date I entered.
You can check it out in our test platform:
https://test.nubuilder.cloud/index.php?u=test&p=nutest
I tested it with an input (format yyyy-mm-dd) and set the hash cookie when the onblur event occurs.
Then in Before Browse I retrieve its value and then in the nuDebug Results I see the date I entered.
You can check it out in our test platform:
https://test.nubuilder.cloud/index.php?u=test&p=nutest
You do not have the required permissions to view the files attached to this post.
-
- Posts: 114
- Joined: Sun Sep 29, 2019 12:40 pm
Re: passing hash cookie values
Kevin
Attached is my system form.
I use YYYY-MM-DD so I probably don't need the replace. It isn't doing any harm.
Attached is my system form.
I use YYYY-MM-DD so I probably don't need the replace. It isn't doing any harm.
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4305
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: passing hash cookie values
is supposed to be$sd = #end_date#;
Code: Select all
$sd = "#start_date#";
Code: Select all
$sd = "#start_date#";
$ed = "#end_date#";
-
- Posts: 114
- Joined: Sun Sep 29, 2019 12:40 pm
Re: passing hash cookie values
Kevin
I'm almost there now. I will tidy it up and if I have problems I will post again.
Many thanks for your help and if you are talking to Janusz thank him for me and wish him all well from me.
Glen
I'm almost there now. I will tidy it up and if I have problems I will post again.
Many thanks for your help and if you are talking to Janusz thank him for me and wish him all well from me.
Glen