I am passing my form results to my own custom php to process the form, build emails, database stuff etc. I use session variables to identify the values from the form elements and everything is fine except for the session variable for a couple of radio buttons that is equal to 'Array' regardless of which button is selected. That is not only of no use to me, but it even triggers a warning/error (Unidentified Index) in the php. How do I get the actual value identifying which button was selected?
Hi Maurice,
What I do is add two hidden inputs and use jquery to add and remove the disable property to them based on which radio that is selected. I then use the hidden input post values in my php scripts.
What I do is add two hidden inputs and use jquery to add and remove the disable property to them based on which radio that is selected. I then use the hidden input post values in my php scripts.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
Hi Eric,
That sounds like a clever little hack but what do you mean by inputs... text fields for instance?
Do you have any sample jquery code since I have never used jquery before?
That sounds like a clever little hack but what do you mean by inputs... text fields for instance?
Do you have any sample jquery code since I have never used jquery before?
1. Make a form with two radio buttons in one group.
2. Name the group myradioname
3. Give one of the buttons a value of Yes and the other a value of No
4. Add two hidden inputs to your form after export. I usually place them near the existing radio buttons
5. Name one hidden input hidden_yes and give it the value of Yes.
6. Name one hidden input hidden_no and give it the value of No.
7. Paste the code below into the head section of your form just above the <title> tag.
This code works with no radio buttons selected when the page loads. A small adjustment is required if you want one of your buttons prechecked at page load.
This is for you to test and see how it works adjust as needed or post back if you have further questions.
2. Name the group myradioname
3. Give one of the buttons a value of Yes and the other a value of No
4. Add two hidden inputs to your form after export. I usually place them near the existing radio buttons
5. Name one hidden input hidden_yes and give it the value of Yes.
6. Name one hidden input hidden_no and give it the value of No.
7. Paste the code below into the head section of your form just above the <title> tag.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script>var jQ = $.noConflict(true);
jQ(function() {
jQ("input[name='myradioname']").click(function() {
if(jQ(this).prop('checked')== true && jQ(this).val()== "Yes" ){
jQ("input[name='hidden_no']").prop("disabled",true);
jQ("input[name='hidden_yes']").prop("disabled",false);
}
if(jQ(this).prop('checked')== true && jQ(this).val()== "No" ){
jQ("input[name='hidden_no']").prop("disabled",false);
jQ("input[name='hidden_yes']").prop("disabled",true);
}
});});</script>
jQ(function() {
jQ("input[name='myradioname']").click(function() {
if(jQ(this).prop('checked')== true && jQ(this).val()== "Yes" ){
jQ("input[name='hidden_no']").prop("disabled",true);
jQ("input[name='hidden_yes']").prop("disabled",false);
}
if(jQ(this).prop('checked')== true && jQ(this).val()== "No" ){
jQ("input[name='hidden_no']").prop("disabled",false);
jQ("input[name='hidden_yes']").prop("disabled",true);
}
});});</script>
This code works with no radio buttons selected when the page loads. A small adjustment is required if you want one of your buttons prechecked at page load.
This is for you to test and see how it works adjust as needed or post back if you have further questions.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
Thanks Eric!
I definitely will get back to you and let you know how it works.
By inputs do you mean text fields?
I definitely will get back to you and let you know how it works.
By inputs do you mean text fields?
No Hidden ones.
<input type="hidden" value="Yes" name="hidden_yes" />
<input type="hidden" value="No" name="hidden_no" />
<input type="hidden" value="No" name="hidden_no" />
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
Thanks Eric, I finally got it tested and it works just great!
I was wasting my time testing it under XAMPP (always goes to a blank page after submit - couldn't even display simple echo statements) and then gave up and uploaded the test project to my web host.
I was wasting my time testing it under XAMPP (always goes to a blank page after submit - couldn't even display simple echo statements) and then gave up and uploaded the test project to my web host.
I added a single checkbox to the form and it also returns 'Array' when my form is forwarded to an external URL.
What is the modified jquery syntax for also handling a single checkbox called 'update'?
What is the modified jquery syntax for also handling a single checkbox called 'update'?
One way
If your update input has a value of Yes.
Add a hidden input call no_update.
If your update input has a value of Yes.
Add a hidden input call no_update.
<input type="hidden" value="Yes" name="no_update" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script>var jQ = $.noConflict(true);
jQ(function() {
jQ("input[name='myradioname']").click(function() {
if(jQ(this).prop('checked')== true && jQ(this).val()== "Yes" ){
jQ("input[name='hidden_no']").prop("disabled",true);
jQ("input[name='hidden_yes']").prop("disabled",false);
}
if(jQ(this).prop('checked')== true && jQ(this).val()== "No" ){
jQ("input[name='hidden_no']").prop("disabled",false);
jQ("input[name='hidden_yes']").prop("disabled",true);
}
});
jQ("input[name='update']").click(function() {
if(jQ(this).prop('checked')== true){
jQ("input[name='no_update']").prop("disabled",true);
}else{jQ("input[name='no_update']").prop("disabled",false);}
});
});</script>
jQ(function() {
jQ("input[name='myradioname']").click(function() {
if(jQ(this).prop('checked')== true && jQ(this).val()== "Yes" ){
jQ("input[name='hidden_no']").prop("disabled",true);
jQ("input[name='hidden_yes']").prop("disabled",false);
}
if(jQ(this).prop('checked')== true && jQ(this).val()== "No" ){
jQ("input[name='hidden_no']").prop("disabled",false);
jQ("input[name='hidden_yes']").prop("disabled",true);
}
});
jQ("input[name='update']").click(function() {
if(jQ(this).prop('checked')== true){
jQ("input[name='no_update']").prop("disabled",true);
}else{jQ("input[name='no_update']").prop("disabled",false);}
});
});</script>
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
Hi Eric,
The checkbox has a display rule which is based on a radio button (value 'No') being selected.
The jquery that handled the radio buttons had no adverse effects on the display rule, but when I added the checkbox jquery function the checkbox now never displays.
Any ideas?
The checkbox has a display rule which is based on a radio button (value 'No') being selected.
The jquery that handled the radio buttons had no adverse effects on the display rule, but when I added the checkbox jquery function the checkbox now never displays.
Any ideas?
Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.