Quantcast
Viewing all articles
Browse latest Browse all 1455

“Selected Value Does Not Exist” on a dynamically generated field

Replies: 0

Hello, I am using JavaScript to dynamically load a select field’s options. Those load just fine, but when a user submits the form, the error message “Selected Value Does Not Exist” pops up underneath that field. Is there a step I may be missing? The field has the class “.propDrop” assigned to it, and arraySelect is an array of the options.

if ( arraySelect.length >= 1 ) {

        //creates the options in the dropdown

        for(var j=0; j<arraySelect.length; j++) {

            var prop = arraySelect[j].property;

            jQuery('.propDrop div select').append('<option value="' + prop + '" data-email="'+ arraySelect[j].email +'" data-id="'+ arraySelect[j].id +'">' + prop + '</option>');

        }

    }

    else {

        jQuery('.propDrop').remove();

    }

Viewing all articles
Browse latest Browse all 1455

Trending Articles