How to create a text input that accepts data in one (scientific) format but stores it in another format

StackOverflow https://stackoverflow.com/questions/18925800

Pergunta

I need to let users enter molarity units into an HTML input (mM, uM, nM, and pM) instead of long string of numbers to the right of the decimal point. "16pM" is easier to type than .000000000016.

The database will be sending the decimal version to the client, and the client has to send the decimal version back to the database. But the user needs to see the human-friendly format and be able to enter the human-friendly format into the textbox.

I can do the conversions, just not sure of the proper place to do them. Do I have to extend the INPUT's prototype? I'd be grateful if someone could get me started in the right direction with a quick description of what's involved in getting an HTML INPUT to do this kind of bi-directional input/output conversion.

I don't need code, just the proper terminology or a couple of helpful links so I can find my way to the right resources. Thanks

Foi útil?

Solução

OK, I've found my way to the jQuery widget factory.

http://learn.jquery.com/jquery-ui/widget-factory/how-to-use-the-widget-factory/

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top