ryancramerdesign / ProcessWire

Our repository has moved to https://github.com/processwire – please head there for the latest version.
https://processwire.com
Other
727 stars 198 forks source link

ModuleConfig doesn't work with InputfieldCheckbox #858

Closed mikerockett closed 9 years ago

mikerockett commented 9 years ago

If I check one and save, it remains unchecked. However, the field does save.

Using PW 2.5.13.

somatonic commented 9 years ago

You have to ckeck it.

Da-Fecto commented 9 years ago

In which context is this @mike-anthony ? Are you talking about the Inputfield settings or are you referring to the ConfigurableModules which are static ?

I do think there's some weirdness going on.

// could you try it this way?
$field = $this->modules->get('InputfieldCheckbox');
$field->attr('name', 'fname');
$field->attr('autocheck', 1);
$field->attr('uncheckedValue', 0);
$field->attr('checkedValue', 1);
$field->attr('value', $this->fname);
mikerockett commented 9 years ago

I've just moved over to the new ModuleConfig.

Even if I force the value, it doesn't seem to work. But I'll try your method.

mikerockett commented 9 years ago

Seems that the value isn't being sent back to the ModuleConfig class.

The field (in my case: $this->experimentEnhancedPathCleaning) is NULL.

Update: Sorry, I see it's not meant to do that anyway... So setting the value manually wouldn't work for any field - ModuleConfig is just not doing it right.

mikerockett commented 9 years ago

In my module, these two fields don't fetch the actual, saved value, but everything else does.

mikerockett commented 9 years ago

Just checked the output markup, it seems that the value attribute is being set, not the checked attribute.

mikerockett commented 9 years ago

I must apologise - I didn't realise that autocheck really was needed here. That said, I think it should be handled by ModuleConfig automatically. Or, at the very least, should be mentioned in the page discussing ModuleConfig.