title: How to execute javascript function on href tags through URL in Laravel
body: <p>Actual scenario:</p>
  
  <ol>
  <li>user click on button 'Jana Laporan', (in case, input field was left empty)</li>
  <li>javascript function execute, but it is return to another VIEW.</li>
  </ol>
  
  <p>Supposed to be, once user clicked on button with left empty its input field, the javascript function remains stay the same VIEW.</p>
  
  <p>Here are my Javascript Function:</p>
  
  <pre><code>function validateInput() {
   var strStartDate = document.ReportSearchForm.StartDate.value;
   var strEndDate = document.ReportSearchForm.EndDate.value;
   var strDptId = document.ReportSearchForm.searchDptId.value;
  
    if (strStartDate == "" &amp;&amp; strEndDate == "") {
       alert("Tarikh (Mula) dan Tarikh (Akhir) dikehendaki.");
       document.ReportSearchForm.strStartDate.focus();
       return false;
    }
    else if ((strStartDate != "" &amp;&amp; strEndDate == "") || (strStartDate == "" &amp;&amp; strEndDate != "")) {
        alert("Tarikh (Mula) atau Tarikh (Akhir) dikehendaki.");
        return false;
    }
    else if (strDptId == "") {
        alert("Jawatankuasa dikehendaki.");
        return false;
    } }
  </code></pre>
  
  <p>Here my button in form :</p>
  
  <pre><code>&lt;a id="transboxShow" class="fancybox" data-fancybox-type="iframe" href="{{ URL::to('laporanjumlahmesyuaratresult/sujk?t=2')}}"&gt;{{ Form::button('Jana Laporan', array('name'=&gt;'btnAdd', 'onclick'=&gt;'return validateInput(); return false;','class'=&gt;'NormalTextCenter', 'data-fancybox-type'=&gt;'iframe') ) }}&lt;/a&gt;
  </code></pre>
  
  <p>how can I execute javascript function through fancybox popup that validate my input field in same VIEW without go to the next url/VIEW ?</p>