Clean a field of search grin in a event of grid result.

Dear all.

I have a Grid that start with search, only one field, after advanced search, appear the grid. Before that in onScriptInit event of GRID, insert a record in database, no problem with this, my real problem, is that I need reset the search form, like do clear button.

I have dealt with:

  • Try to call limpa_form, javascript function in event onScriptInit of GRID with sc_ajax_javascript macro, but the result is that not found.
  • Try create the same function with other name, but no recognizes
    function PERS_limpa_form() {
    nm_campos_between(document.getElementById(‘id_vis_reg_ip’), document.F1.reg_ip_cond, ‘reg_ip’);
    document.F1.SC_reg_ip.value = “”;
    document.F1.reg_ip_autocomp.value = “”;
    fail in the first step, say that reset is not a function.
  • Try with document.getElementById(‘id_vis_reg_ip’).value="", but say that this object is not in the page.

Please, if any person know a way, please let me know how I can do this.

Thanks and regards,

Section Search -> Avanced Search -> Keep Values: No



That’s not work, I forget to comment that I test too, also, not do anything, I mean, that is for when you reload the search form, keep the filter or not, but, although is set in YES, the filter no appear when you reload the page.

Anyway, is not a solution for my problem. For a clear idea, enclosed a screenshot for my App.

Thanks for your comment.

grid search.jpg

What you could do is clear the field in the onValid event of the advanced search.
It’s probably not exactly what you want because it clears the select field every time.
But it’s worth a try.

echo “<script>parent.document.getElementById(‘SC_reg_ip’).selectedIndex = 0;</script>”;


Finally, about the option “Section Search -> Avanced Search -> Keep Values: No”, scriptcase support response that is a bug, I found with this, 4 bugs. In order to prevent double insert, reason for what I want to clear field, use some variables to compare value, is after search the value is equal to old value, only appear a message, if not, insert and show.