[pmwiki-devel] ExtensionHub input tags

Petko Yotov 5ko at 5ko.fr
Thu Aug 22 02:42:37 PDT 2024


On 22/08/2024 11:03, Simon wrote:
> Would I be correct in guessing that ExtensionHub cannot parse this,
> for example
> 
> Show heading level 3 for each group of messages (default):
> -> (:input hidden   id="headingHide" name="MessagesReplacementHeading"
> value="on"   label="heading on":)
> -> (:input checkbox id="headingShow"
> name="MessagesReplacementHeading" value="off"  label="heading off":)

The hub doesn't parse your form, it saves the form fields as submitted 
by the browser, except empty ones.

Having a hidden field AND a checkbox with the SAME name might be 
submitted by the browser in the wrong order.

Instead, if you have only the checkbox, the hub should store and return 
its value if checked, and clear from storage and return nothing it if 
empty. You can check with isset() or simply set/merge the default to 
your default values.

Overall, hidden fields should probably not be used in hub forms, but 
instead their values added to your default values array in PHP, and 
merged like shown in the ExtensionDesign page.

Default values should not be stored, it is faster to just assign them 
from your PHP code than by reading additional lines in the configuration 
storage file.

Petko



More information about the pmwiki-devel mailing list