checkboxes

Use this board to ask questions or have discussions with other Genie users.
Post Reply
dkmccammon
Profound User
Posts: 48
Joined: Wed Apr 12, 2017 4:44 pm
First Name: Darin
Last Name: McCammon
Company Name: NAICO
Phone: 4052584301
Address 1: 1010 Manvel Ave
City: Chandler
State / Province: Oklahoma
Zip / Postal Code: 74834
Country: United States
Contact:

checkboxes

Post by dkmccammon »

I have tried to write a function for checkboxes, but it's not working.

This is what I wrote:

function handleCheck(check, field) {
var checkbox = document.getElementsByClassName("checkBoxes").checked;
pui.set(field,checkbox);

}

Then in the Genie on the Onclick Event I put handleCheck("Y", "I_3_26_W2");
where I_3_26_W2 is where the value Y needs to be placed or N if the checkbox is not checked.
I have set the initialization value to "N".

Can you please assist me in the best way to approach checkboxes? I tried searching the forums for the checkboxes but didn't find anything.
dkmccammon
Profound User
Posts: 48
Joined: Wed Apr 12, 2017 4:44 pm
First Name: Darin
Last Name: McCammon
Company Name: NAICO
Phone: 4052584301
Address 1: 1010 Manvel Ave
City: Chandler
State / Province: Oklahoma
Zip / Postal Code: 74834
Country: United States
Contact:

Re: checkboxes

Post by dkmccammon »

Please disregard, I found the solution.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: checkboxes

Post by Scott Klement »

I'm glad you found a solution. For the benefit of other people who read these forums, can you show us what you did?

My understanding of this routine is that it should set a checkbox to either Y or N (I'm assuming these are the values of the checked/unchecked value properties of the checkboxes?) If so, I would expect the routine to be as simple as this:

Code: Select all

function handleCheck(check, field) {
  pui.set(field,check);
}
But, the fact that you have written code to retrieve an array of all HTML elements that contain the "checkBoxes" CSS class makes me wonder if I'm misinterpreting what you're trying to do. Obviously the code wasn't right (adding .checked to the getElementsByClassName doesn't make any sense, and setting one field on the screen to the array of all checkboxes doesn't make any sense.) But I can't tell what the right solution would be, because I'm not sure that I understand what the routine is supposed to do.

Since you have a solution, maybe you could just post it for other people to learn from?
dkmccammon
Profound User
Posts: 48
Joined: Wed Apr 12, 2017 4:44 pm
First Name: Darin
Last Name: McCammon
Company Name: NAICO
Phone: 4052584301
Address 1: 1010 Manvel Ave
City: Chandler
State / Province: Oklahoma
Zip / Postal Code: 74834
Country: United States
Contact:

Re: checkboxes

Post by dkmccammon »

Sure... for my situation I changed field type of the previous element (output field) to a checkbox field type and ensured that the checked value was 'Y' and the unchecked value was 'N'. However, dragging a checkbox from the widgets and trying to tie that into the screen did not work.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest