• Resolved webbtj

    (@webbtj)


    Found a slight issue with 3.9.8 with <select> fields. Not so much a “bug” as allowing for bunk user input. If a user provides a list of comma separated options, they are probably going to put spaces of the commas. I’ve noticed in 3.9.8 that this will cause issue with the <option> not being selected in the <select> field because the value attribute of the <option> actually contains a space and the comparison value does not. Basically the value is being trimmed somewhere and not somewhere else. My solution was to re-trim these values when going the actual comparison when outputting the selected="selected" attribute (ln 304 of register-plus-redux.php). A better solution is probably to consistently trim/do not trim when the data is being written to the DB, but this is a band-aid solution. Also, WordPress provides a selected function that handles the outputting of the selected="selected" attribute based on conditions, might as well toss that in there. I replaced ln 304 with the below which addresses the trimming issue and utilizes WordPress’ selected function.

    selected( trim( $meta_value ), trim( esc_attr( $field_option ) ) );

    -TJ

    https://www.ads-software.com/extend/plugins/register-plus-redux/

Viewing 1 replies (of 1 total)
  • Plugin Author radiok

    (@radiok)

    I believe I resolved this issue in 3.9.9+, sorry for the delay, but I think you shouldn’t need anymore hacking to get this behavior.

Viewing 1 replies (of 1 total)
  • The topic ‘Issue with selected options in select fields’ is closed to new replies.