Closed (won't fix)
Project:
Form Defaults
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Feb 2010 at 01:07 UTC
Updated:
18 Feb 2010 at 20:48 UTC
I am looking for a way to change the default state of o radio button. Do you think this would be possible with Form Defaults?
Comments
Comment #1
metzlerd commentedChanging the default value of a radio is pretty invasive stuff. You also wouldn't really be able to tell whether the default value was a default, or the currently selected value. So in short, I don't think that this can be achieved with form defaults, because the drupal forms api doesn't really distinguish between the current and default values.
Comment #2
roball commentedThanks for clarifying. In particular, I only need to change the radio "Status" on admin/user/user/create to be changed from "Active" to "Blocked". Could you please make any recommendation on how to accomplish this?
Comment #3
metzlerd commentedSure. A custom module that implements hook_form_alter and adjusts the default value. Code would look something like.
Comment #4
roball commentedThank you David! I will likely do this in a custom module since I really need this functionality and haven't yet found an existing module that would also be able to do that.
However, then I would need to have yet another module enabled for just this little piece of code...
You wouldn't think of including this feature to your module as an option, would you?
Comment #5
metzlerd commentedI'm afraid not (at least at this time) I generally have one custom module on my site that I put all of these kinds of "hacks" in, along with other functions that I might use in PHP theme snippets. I'd advise you to do the same.
If I ever get around to doing a chunk of custom code for the user_register module (there's a separate issue for that) I'll reconsider it. Allowing this functionality for ANY form is just way to dangerous. I've had to draw a similar line around Submit button labels.