HOWTO : Lock Form Field

Sedikit coba-coba dengan event di javascript, akhirnya nemu satu trik sederhana untuk mengunci form agar tidak bisa di-edit tanpa menambahkan atribut readonly maupun disable.
Berikut caranya :

<form name="form">
     <input type="text" size="12" onfocus="this.blur()" value="Locked text!" name="box" />
</form>

.
Perhatikan pada event onFocus, kita beri dia perintah this.blur(), sehingga field tersebut tidak pernah menerima focus.

Author: Arief Bayu Purwanto

Hello, my name is Arief Bayu Purwanto, a 24 years old father of a beautiful daughter. Interested in online programming, linux, games, and reading. Currently working on kapanlagi.com as junior developer. I live in a relatively quite and cool place called Malang. I'm available for some freelance stuff as well as some consulting job. You can see my portofolio for some previous task I've finished and some other information related to my capability. Btw, I'm plurking here.

  • didats

    huehue!
    gak terpikirkan.
    thanks yo

  • didats

    huehue!
    gak terpikirkan.

    thanks yo

  • basibanget

    salah fokus?

  • basibanget

    salah fokus?

  • Arief Bayu Purwanto

    Ya… gitu deh.

  • Arief Bayu Purwanto

    Ya… gitu deh.