Nobody likes fill up the same form again and again. a few months back when my project manager introduced Project log, I used to fill up the same form daily with my name, email, offshore/onshore, developer/tester/designer, support/development. you know some data are constant, so I was finding some shortcut to do it. Then I found this tricks to fill constant data automatically.

Browser bookmark has a power to execute your custom javascript script.




Suppose you have a form like this:

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
<form>
    <div class="form-group">
        <label for="email">Email address:</label>
        <input type="email" class="form-control" id="email">
    </div>
    <div class="form-group">
      <label for="country">Select country:</label>
      <select class="form-control" id="country">
        <option>Afganistan</option>
        <option>Bangladesh</option>
        <option>India</option>
        <option>Indonesia</option>
        <option>Thailand</option>
        <option>Usa</option>
      </select>
    </div>
    <div class="form-group">
        <label for="comment">Comment:</label>
        <textarea class="form-control" rows="5" id="comment"></textarea>
    </div>
</form>

Now if you fill up this input fields with javascript your javascript is like:

1
2
3
document.getElementById('email').value="arka@coderexample.com";
document.getElementById('country').value="India";
document.getElementById('comment').value="lorem Ipsum sample text";

you can run this code from your bookmark address/location with a self-executed function like:




1
javascript:function myRandomFunc(){ document.getElementById('email').value="arka@coderexample.com";document.getElementById('country').value="India";document.getElementById('comment').value="lorem Ipsum sample text";}myRandomFunc();   

I tried this tricks both in Firefox as well chrome, it works! I haven’t tried Internet explorer as I uninstalled it. As a developer, It saves lots of time of mine. you can also use this trick to any form like ticket booking or some time tracker.