Hello,
I have a very basic question, but I can't find a solution anywhere on the forum. I have 5 checkboxes on my Chronoform which each save to MySQL TinyInt fields as 0 or 1. They are all unrelated. I want the default state to be not checked which should correspond to the DB field value of 0 and checked state for field value of 1. Default state of the checkbox is UnChecked.
Interesting things are happening and I am a bit lost. When I check any box of the 5, all get checked and I have 0s in all fields when only one of them should be 0. The boxes are unchecked only when the value is Null in its field. I don't understand, when will the field value be 1. I read some post saying 0s don't save.
http://www.chronoengine.com/forums/posts/f3/t96252/cf5-changing-checkbox-value.html
I am using a Model Id so my fields are written as ab[ip_reply_recvd] where "ab" is the Model Id. By default all are unchecked and default value I have set is 0.
Primary questions:
- What is the value in field when checkbox is unticked, what is the value for ticked state
- What corresponds to null in field
- My checkboxes are unrelated, do I still need to add "Handle Arrays" before the "DB Save" action
Thanks, Amal
I have a very basic question, but I can't find a solution anywhere on the forum. I have 5 checkboxes on my Chronoform which each save to MySQL TinyInt fields as 0 or 1. They are all unrelated. I want the default state to be not checked which should correspond to the DB field value of 0 and checked state for field value of 1. Default state of the checkbox is UnChecked.
Interesting things are happening and I am a bit lost. When I check any box of the 5, all get checked and I have 0s in all fields when only one of them should be 0. The boxes are unchecked only when the value is Null in its field. I don't understand, when will the field value be 1. I read some post saying 0s don't save.
http://www.chronoengine.com/forums/posts/f3/t96252/cf5-changing-checkbox-value.html
I am using a Model Id so my fields are written as ab[ip_reply_recvd] where "ab" is the Model Id. By default all are unchecked and default value I have set is 0.
Primary questions:
- What is the value in field when checkbox is unticked, what is the value for ticked state
- What corresponds to null in field
- My checkboxes are unrelated, do I still need to add "Handle Arrays" before the "DB Save" action
Thanks, Amal
Hello amsharma,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How can I show/hide a textarea when a checkbox is clicked?
P.S: I'm just an automated service😉
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How can I show/hide a textarea when a checkbox is clicked?
P.S: I'm just an automated service😉
Hi Amal,
Do your checkboxes have different names?
Do the names have [] at the end - which would make them into an array?
Do you mean checkboxes i.e. square boxes rather than round radio buttons?
Normally a checkbox only has one value - if it is checked that value is returned, if it not checked then nothing is returned.
Bob
Do your checkboxes have different names?
Do the names have [] at the end - which would make them into an array?
Do you mean checkboxes i.e. square boxes rather than round radio buttons?
Normally a checkbox only has one value - if it is checked that value is returned, if it not checked then nothing is returned.
Bob
GreyHead,
Thanks for your prompt response. Answers to your queries:
- Yes, my checkboxes all have different names and correspond to different fields in a table.
- No, they don't have [] at the end of names.
- Yes, I am using checkboxes, NOT radio buttons.
I got your point about one value, I am used to two values but that's ok, I can probably live with that. If I set default value as 1 then it will be 1 when its checked and nothing when not checked, right?
You will still need to help me with the issue of how to get all of them to work independent of each other.
Amal
Thanks for your prompt response. Answers to your queries:
- Yes, my checkboxes all have different names and correspond to different fields in a table.
- No, they don't have [] at the end of names.
- Yes, I am using checkboxes, NOT radio buttons.
I got your point about one value, I am used to two values but that's ok, I can probably live with that. If I set default value as 1 then it will be 1 when its checked and nothing when not checked, right?
You will still need to help me with the issue of how to get all of them to work independent of each other.
Amal
Hi Amal,
Just to confirm. when the box is checked the value is 1, when it is not checked there is nothing submitted.
You don't need a Handle Arrays action.
Please drag a Debugger action into your form and post a link to it so that I can take a quick look.
Bob
Just to confirm. when the box is checked the value is 1, when it is not checked there is nothing submitted.
You don't need a Handle Arrays action.
Please drag a Debugger action into your form and post a link to it so that I can take a quick look.
Bob
GreyHead,
I sent you the login details on PM yesterday. Kindly have a look.
If I check any of the checkboxes it makes field values 0 for all the fields (that is the default value) although you said, nothing is sent. I don't see a value of 1 anywhere. I just want to save the value of the checkbox ticked status in the database.
Amal
I sent you the login details on PM yesterday. Kindly have a look.
If I check any of the checkboxes it makes field values 0 for all the fields (that is the default value) although you said, nothing is sent. I don't see a value of 1 anywhere. I just want to save the value of the checkbox ticked status in the database.
Amal
Hi Amal,
I can't quite see what is happening but I think that it is partly because you have used array names for most of the inputs as you explained - you don't need to do that - just set the DB Record Loader to not use a Mode ID. And you have ghost inputs set for the checkboxes with no values - possibly they are 0 but nothing shows up in the Form HTML.
If you look at the submitted data you will see both entries. Adding a Debugger action would show you more clearly what is happening.
Bob
I can't quite see what is happening but I think that it is partly because you have used array names for most of the inputs as you explained - you don't need to do that - just set the DB Record Loader to not use a Mode ID. And you have ghost inputs set for the checkboxes with no values - possibly they are 0 but nothing shows up in the Form HTML.
If you look at the submitted data you will see both entries. Adding a Debugger action would show you more clearly what is happening.
Bob
GreyHead,
Ok, its working now. I do need to use the Model ID, when I created the form long time back, what I wanted to achieve wasn't working without Model ID - I needed Chronoconnectivity etc. I wasn't sure how Ghost input works so I had left them to default value. I understand now, I think I should set it to 0.
What I did was set "default value" for each CheckBox as 1. On NULL or 0 in the table, the CheckBox is not checked now. I had asked you if doing that would solve the issue. I will also check the Debugger and verify what you wrote above.
Thanks, Amal
Ok, its working now. I do need to use the Model ID, when I created the form long time back, what I wanted to achieve wasn't working without Model ID - I needed Chronoconnectivity etc. I wasn't sure how Ghost input works so I had left them to default value. I understand now, I think I should set it to 0.
What I did was set "default value" for each CheckBox as 1. On NULL or 0 in the table, the CheckBox is not checked now. I had asked you if doing that would solve the issue. I will also check the Debugger and verify what you wrote above.
Thanks, Amal
This topic is locked and no more replies can be posted.
