Web Connection
Radio button value not in form vars
Gravatar is a globally recognized avatar based on your email address. Radio button value not in form vars
  n/a
  All
  Oct 23, 2014 @ 07:54pm
I have a page that's not returning all the form vars. Specifically, I'm not getting the value of a radio button in the form vars. I use Request.aFormVars(@FormVarsArray) and the values for some radio buttons in use are not in that array. I know checkboxes with values of false don't come across on the submit, but radio button values should, right? And the value from other radio buttons are, but not all of the ones in use on the form. Any ideas on what could cause this?

Gravatar is a globally recognized avatar based on your email address. Re: Radio button value not in form vars
  n/a
  Russell Campbell
  Oct 23, 2014 @ 08:21pm
Are disabled controls not submitted? It appears that's what's happening here. The radio button in question controls the enabled/disabled status of other controls and not only is the radio button value not submitted when the other controls are disabled, but the values for those controls are not submitted, either.


I have a page that's not returning all the form vars. Specifically, I'm not getting the value of a radio button in the form vars. I use Request.aFormVars(@FormVarsArray) and the values for some radio buttons in use are not in that array. I know checkboxes with values of false don't come across on the submit, but radio button values should, right? And the value from other radio buttons are, but not all of the ones in use on the form. Any ideas on what could cause this?

Gravatar is a globally recognized avatar based on your email address. Re: Radio button value not in form vars
  n/a
  Russell Campbell
  Oct 23, 2014 @ 08:51pm
Yes, that was the problem. I meant to disable the other controls, but the Javascript also disabled the main control that disables the others, so that control's value was not being submitted. Bleepin' computers that do what I tell them to do instead of what I meant for them to do!


Are disabled controls not submitted? It appears that's what's happening here. The radio button in question controls the enabled/disabled status of other controls and not only is the radio button value not submitted when the other controls are disabled, but the values for those controls are not submitted, either.


I have a page that's not returning all the form vars. Specifically, I'm not getting the value of a radio button in the form vars. I use Request.aFormVars(@FormVarsArray) and the values for some radio buttons in use are not in that array. I know checkboxes with values of false don't come across on the submit, but radio button values should, right? And the value from other radio buttons are, but not all of the ones in use on the form. Any ideas on what could cause this?


Gravatar is a globally recognized avatar based on your email address. Re: Radio button value not in form vars
  Rick Strahl
  Russell Campbell
  Oct 24, 2014 @ 03:29pm

I can't recall if Disabled controls don't return values but I know ReadOnly fields are definitely not. It's a browser issue - they simply don't set those values.

But - if those values are not enabled why would you care whether they come back or not? If you're binding to your model you should always ensure you first load the model with values from the DB (or whereever) then unbind into that. So if a value is not set you get the original value that was on the model.

Unchecked radio buttons also are not forwarded just like checkboxes. Basically all toggle controls only send a value if they're toggled.

+++ Rick ---


I have a page that's not returning all the form vars. Specifically, I'm not getting the value of a radio button in the form vars. I use Request.aFormVars(@FormVarsArray) and the values for some radio buttons in use are not in that array. I know checkboxes with values of false don't come across on the submit, but radio button values should, right? And the value from other radio buttons are, but not all of the ones in use on the form. Any ideas on what could cause this?



Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

Gravatar is a globally recognized avatar based on your email address. Re: Radio button value not in form vars
  n/a
  Rick Strahl
  Oct 24, 2014 @ 04:49pm
In Chrome at least, disabled controls are not submitted. And, yes, if they are disabled, I don't care about their values. There was a radio button that was used to control the enabled/disabled status of all the controls on the page, but the Javascript disabled the second button in the group and so it wouldn't save that setting (which was a "Don't Use" setting that disabled all the other controls). Anyway, a little adjusting of the Javascript and I'm back in business.

I can't recall if Disabled controls don't return values but I know ReadOnly fields are definitely not. It's a browser issue - they simply don't set those values.

But - if those values are not enabled why would you care whether they come back or not? If you're binding to your model you should always ensure you first load the model with values from the DB (or whereever) then unbind into that. So if a value is not set you get the original value that was on the model.

Unchecked radio buttons also are not forwarded just like checkboxes. Basically all toggle controls only send a value if they're toggled.

+++ Rick ---


I have a page that's not returning all the form vars. Specifically, I'm not getting the value of a radio button in the form vars. I use Request.aFormVars(@FormVarsArray) and the values for some radio buttons in use are not in that array. I know checkboxes with values of false don't come across on the submit, but radio button values should, right? And the value from other radio buttons are, but not all of the ones in use on the form. Any ideas on what could cause this?



© 1996-2024