Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

toggle button on browse screen

Post Reply
Henk_2a
Posts: 52
Joined: Sun Feb 14, 2016 8:42 pm
Location: Nederland

toggle button on browse screen

Unread post by Henk_2a »

Hello,

I need a toggle-button on the browsescreen which alllows me to filter the records on the browse screen
I managed to make a jsscript for the button:

function nuLoadBrowse() {

var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();

if(dd<10) {
dd='0'+dd;
}

if(mm<10) {
mm='0'+mm;
}
today = "'" + yyyy+'-'+mm+'-'+dd + "'";
jsdatum=today;

/* Append a new Action Button on Browse form */
var space = $( "#nuSpace" ).clone().removeAttr("id");
$( "#nuActionButtonHolder" ).append(space);

var elem = '<input id="execButton" type="button">';
$( "#nuActionButtonHolder" ).append(elem);
$( "#execButton" )
.addClass( "nuButton" )
.attr( "value", "Alles" )
.click(function() {
if (this.value == "Toekomst")
{
this.value = "Alles";
jsdatum=today;
}
else
{
this.value= "Toekomst";
jsdatum='2001-01-01';
}
}
);
}

The button works, but now I need to transger the value from the variable "jsdatum" to either the sql of the form or to the filter
I haven't got a clue how to transfer this, I think I will need a Hash-variabel, but I cant solve it.
And I do not jnow the proper syntax for this value. I tried to look it up with nudebug, but no success.
Furthermore I wonder if each change will cause an automatic requery.
Anyone know how to do this?

As you might notice I am a newbie, but I already love Nubuilder.
Thanks!
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: toggle button on browse screen

Unread post by admin »

Henk_2a,

Try..

Code: Select all

$('#nuSearchField').val(jsdatum);
Steven
Henk_2a
Posts: 52
Joined: Sun Feb 14, 2016 8:42 pm
Location: Nederland

Re: toggle button on browse screen

Unread post by Henk_2a »

thanks for your answer, but I haven't got a clue what you mean. yes, i tried and tried.

To narrow my question, if I use a hash-variable in the main sql of a form, how do I assign a value to that hash-variable in PHP

Sorry for the question .....
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: toggle button on browse screen

Unread post by admin »

Henk_2a,

If you put this..

Code: Select all

$('#nuSearchField').val(jsdatum);
in your JavaScript it will copy the variable jsdatum to the field named nuSearchField (The green search field)

Steven
Henk_2a
Posts: 52
Joined: Sun Feb 14, 2016 8:42 pm
Location: Nederland

Re: toggle button on browse screen

Unread post by Henk_2a »

it took me some time to understand this, your answers often raise a lot of questions.
My knowledge of JavaScript is slowly increasing and so I understand your javascript-answers more and more.
At the end this answer solved my problem, thanks !
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: toggle button on browse screen

Unread post by admin »

great!
Post Reply