Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter bootstrap select readonly still able to change options

Tags:

I have a bootstrap select with readonly="true" but I can still change the selected option.

I need the disabled="true" behavior, but when I use this the select is not submitted.

I need a combination of the 2, the selected option can not be changed but the select has to be submitted.

I could use hidden fields, but I was hoping for an easier solution.

like image 912
Ruben Avatar asked Sep 29 '15 14:09

Ruben


1 Answers

I've run into a similar issue and what i do is when the form onsubmit event is fired remove the disabled attributes as the browser will not post disabled attributes back to the server.

$('form').submit(function () { $('[disabled]').removeAttr('disabled'); })

As you mentioned the only other option i have found is to find the values to hidden inputs.

like image 81
Sean Wessell Avatar answered Sep 17 '22 15:09

Sean Wessell