This topic is locked
[SOLVED]

 get value from checkbox in model

11/9/2018 6:31:53 AM
PHPRunner General questions
J
jacques author

(sorry, title must be "get value from checkbox in modal")

Hi,
[size="2"]I use the given example from https://xlinesoft.co...ected_users.htm[/size]
It is working perfect until ik want to use a checkbox

I don't get the value of the checkbox.
Can someone help me out?

How to get the checkbox value!

if ( proxy["emailUsers"]=== true ) {

params["emailSubject"] = proxy["emailSubject"];

params["CheckCategorie"] = proxy["CheckCategorie"];

proxy["emailUsers"] = false;

return true;

}
var selBoxes = pageObj.getSelBoxes( pageid ),

args = {

modal: true,

height: 450,

header: "Selectie van mail template",

html: '<div class="form-group">'

+ '<label>Onderwerp van de mail </label>'

+ '<input class="form-control" type="text" placeholder="Moet worden ingevuld ..." id="emailSubject">'

+'</div>'

+'<div class="form-check">'

+ '<label class="form-check-label">'

+ '<input class="form-check-input" type="checkbox" value="" id="CheckCategorie1"> ical(kalender)'

+ '</label>'

+'</div>',

footer: '<a href="#" id="emailUsersSave" class="btn btn-primary">' + Runner.lang.constants.TEXT_SAVE + '</a>'

+ '<a href="#" id="emailUsersCancel" class="btn btn-default">' + Runner.lang.constants.TEXT_CANCEL + '</a>',

afterCreate: function( win ) {

$("#emailUsersSave").on("click", function( e ) {

var context = win.body();

proxy["emailUsers"] = true;

proxy["emailSubject"] = $("#emailSubject", context).val();

proxy["CheckCategorie"] = $("#CheckCategorie1", context).val();

/////////////////////////////////////////

console.log('4 '+proxy["CheckCategorie"]);

/////////////////////////////////////////

$('[id="' + ctrl.id + '"]').click();

e.preventDefault();

win.destroy();

});

$("#emailUsersCancel").on("click", function( e ) {

e.preventDefault();

win.destroy();

});

}

};



if ( selBoxes.length == 0 || !confirm('Wil je echt de geselecteerde een email sturen?') ) {

return false;

}
Runner.displayPopup( args );

return false;


gr
Jacques

admin 11/12/2018

You need to set a breakpoint at the following line:

proxy["CheckCategorie"] = $("#CheckCategorie1", context).val();


And once it breaks you need to examine the value of $("#CheckCategorie1", context).val(); in console.

J
jacques author 11/12/2018



You need to set a breakpoint at the following line:

proxy["CheckCategorie"] = $("#CheckCategorie1", context).val();


And once it breaks you need to examine the value of $("#CheckCategorie1", context).val(); in console.


Sergey,
Thank you for your reply.

I Think I asked the question wrong.

In the console I can see the value, is but it does not change.

I can't read out the value checked or uncheked.

I'm doing something wrong but I don't know what
Gr

admin 11/13/2018

I'm not sure what can be done by just looking at this code. Someone needs to step through the code, see value of $("#CheckCategorie1", context).val(), then see what gets assigned to proxy["CheckCategorie"] etc. You cannot guess, need to see what exactly is happening.

J
jacques author 11/23/2018



I'm not sure what can be done by just looking at this code. Someone needs to step through the code, see value of $("#CheckCategorie1", context).val(), then see what gets assigned to proxy["CheckCategorie"] etc. You cannot guess, need to see what exactly is happening.


I got my answer
proxy["CheckCategorie1"] = $("#CheckCategorie1").is(":checked") ;
this gives true or false
thanks for thinking