victor-valencia / bootstrap-iconpicker

A simple icon picker
https://victor-valencia.github.com/bootstrap-iconpicker/
MIT License
378 stars 140 forks source link

Get Character instead of CSS Class when Submitting in Form #25

Closed lukasnagl closed 6 years ago

lukasnagl commented 9 years ago

I would like to use the iconpicker in a form to pick the icon for a user. In the (rails) backend, I need the character, though, instead of the css class.

My current iconpicker:

<button type="button" class="btn btn-default" role="iconpicker" name="user[icon]"></button>

A typical icon:

.myicon-typical:before{content:"\e6bd"}

When submitting the form, the icon gets delivered as the css-class “myicon-typical”, instead of the character. Is it possible to configure the iconpicker to send the character instead? Am I going at this from the wrong angle?

lukasnagl commented 9 years ago

As a workaround, I have defined a matching between the class name and the unicode value in the backend, but I would still be interested if iconpicker can be modified to do this.

victor-valencia commented 6 years ago

Hi @j4zz

A solution is resolved in this fiddle.

Regards.