Skip to content

Question - Radio elements and post-validation state #10

@emeraldjava

Description

@emeraldjava

Hey,

I've a simple form with three radio elements. My issue is that if validation fails on any of the elements in the form, the state of the radio elements is lost. This does not happen for the text elements. I'm wondering is there something i'm expected as the form developer to handle this case or should the framework be expected to handle this.

My code

        $gender_drop_down = WP_Form_Element::create('radios')->set_name('bhaa_gender')
            ->set_label('Gender')->set_classes(array('radio-inline'))
            ->add_option('M','M')
            ->add_option('W','W');

and a screen shot of the form

image

Note - The gender field was selected before this form was submitted. I just want to avoid have to re-check the three radio buttons each time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions