I'm putting together a simple enough app that involves calculating a number of inputs. Each input is multiplied by a number, and all are added together. Most inputs are textual, and it works fine.
However, some of these inputs are checkboxes. If the box is checked, I need the input to be a 1, if not checked, the input is a 0.
It seems to me like it's a fairly straightforward thing, but I can't seem to find out how to do this after searching all over. Does it involve setting up a variable or something?
All depends upon what you want to do with that input. Here I used a global variable but the logic would be the same with many different possibilities like changing a label's text, or a textbox's text etc:
Thanks a lot for the reply.
I've added a shot of the block I'm working on. The gaps are where I need to put the 1 or 0 (based on the checkbox result).
<img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAi0AAA F1CAIAAACrvk0iAAAgAElEQVR4nOyd d1yT1/7Hae+9HbftbW/ v7W61Kip7hg1hqrhFAUW2LGUkEEBAB EVFVkLYe2+ y92KGHXhCAmGEvRWQIe5qLb8/ wAEGR9vb8Ws+r8/Ll3nmOQ/
I've added a shot of the block I'm working on. The gaps are where I need to put the 1 or 0 (based on the checkbox result).
<img src="data:image/png;base64,
~~~~~~~~~~~~~~~~~~~~~~~~
z0jlz3wGlIFNlIyImNX6GcbYQzzret XbNmISeo557nvr5L6i1LlRZJeW4jPr 589Tzz42qaM+u/ tTjHWaGpkQgKmdzKvb4cP993uHHH51 u33EMjnDZwMkEEdkTeMjcNbOsvs1g7 rhy48EcnoM39Ypgwhat90mUhxRSnkk du+ Nb9h5snWMS2qFIMuBofUxRR3BBvy4P iRW0h+Y9aA
...
Sorry, screenshot didn't show up.
I've attached it here.
I've attached it here.
Here you go.. adapt it to your blocks:
you also can use the following blocks and add them directly into your current blocks
While that's a nice solution, he'd need 3 sets of those in his existing block code when he really only needs to set it once...
@Enis: it has been said
some of these inputs are checkboxes. If the box is checked, I need the input to be a 1, if not checked, the input is a 0.
which means, there is more than 1 checkbox...
point taken...
Thanks guys. That works really nicely. I press submit and I get the final sum on the screen, printed in a "blank" label that I have.
While we're on a roll here.... :P
The next level of complexity that I have is a two-parter:
1. When I press "Submit", I want to open a new screen, and display the numerical result there.
2. Finally, I want to use a variable to print a pre-defined statement. If the result is <1, then print statement A, if it's >1, print statement B.
Any ideas?
While we're on a roll here.... :P
The next level of complexity that I have is a two-parter:
1. When I press "Submit", I want to open a new screen, and display the numerical result there.
2. Finally, I want to use a variable to print a pre-defined statement. If the result is <1, then print statement A, if it's >1, print statement B.
Any ideas?
댓글 없음:
댓글 쓰기