Fill fields in webview programmatically
<p>I was trying to insert values into fields in a webpage loaded inside a webview .</p>

<p><strong><em>The exact thing i was doing was this -</em></strong></p>

<pre><code>String date = "5/8/1994";
webview.loadUrl("javascript:var uselessvar_a =document.getElementById('dpStudentdob_dateInput').value='" + date + "';");
</code></pre>

<p><strong><em>Problem</em></strong></p>

<ul>
<li>So this is suppose to insert the value into the field into the given
id. and it gives me the exact result , it insert into the field. but
when the submit button is pressed the error is shown as this data is
not correct. but when i insert the values by typing the same value is
accepted.</li>
<li>The problem is with inserting value into the DOB field in the
webpage.</li>
<li>The registration number field works fine and the clicking button also
works fine in my code.</li>
</ul>

<p>the webpage is was loading is <a href="http://www.bputexam.in/StudentSection/ResultPublished/StudentResult.aspx" rel="nofollow">this</a>.</p>

<p>I want to enter the date into the date DOB field in the webpage.</p>

<p><strong><em>My full java class is-</em></strong></p>

<pre><code>public class MainActivity extends AppCompatActivity {

WebView webview;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    webview = (WebView) findViewById(R.id.webView);

    webview.getSettings().setBuiltInZoomControls(true);
    webview.getSettings().setDisplayZoomControls(false);

    webview.getSettings().setUseWideViewPort(true);
    webview.getSettings().setLoadWithOverviewMode(true);

    webview.getSettings().setJavaScriptEnabled(true);
    webview.setWebChromeClient(new WebChromeClient());

    webview.getSettings().setDomStorageEnabled(true);

    webview.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            String password = "1201329022";
            String date = "5/8/1994";
            webview.loadUrl("javascript:var uselessvar =document.getElementById('txtRegNo').value='" + password + "';");
            webview.loadUrl("javascript:var uselessvar_a =document.getElementById('dpStudentdob_dateInput').value='" + date + "';");
            webview.loadUrl("javascript:var uselessvar_b =document.getElementById('btnView').click();");
        }
    });

    webview.loadUrl("http://bputexam.in/StudentSection/ResultPublished/StudentResult.aspx");
}

}
</code></pre>

<p><em>Do any one have any suggestion for this.</em></p>