This topic is locked

Advanced search form - reset date range does not work

4/17/2007 8:00:17 AM
PHPRunner General questions
M
mrpeeble author

HI, I am using a demo of PHPRunner
When I specify a date range on the advanced search the records in the date range display properly.
If i then hit 'reset', the date range fields clear and I perform a new search with no criteria, no records show. I have to actually log out of the program and back in to get the records visible again.
any insight you can provide would be helpful.

Alexey admin 4/17/2007

Hi,
thank you for pointing me to this bug.

We'll fix it with the next update of PHPRunner.

To get it working now modify search.php file in C:\Program Files\PHPRunner3.1\source folder

Find this snippet there:

}

ShowHideControls();

return false;

}

and insert these lines just before:

else if(e[i].name.substr(0,6)=='value_' && e[i].type=='hidden')

e[i].value = '';



Then rebuild your project.

M
mrpeeble author 4/17/2007

I added the line your suggested and my ResetControls function now looks as follows:
function ResetControls()

{

var i;

e = document.forms[0].elements;

for (i=0;i<e.length;i++)

{

if (e[i].name!='type' && e[i].className!='button' && e[i].type!='hidden')

{

if(e[i].type=='select-one')

e[i].selectedIndex=0;

else if(e[i].type=='select-multiple')

{

var j;

for(j=0;j<e[i].options.length;j++)

e[i].options[j].selected=false;

}

else if(e[i].type=='checkbox' || e[i].type=='radio')

e[i].checked=false;
// tom added this

else if(e[i].name.substr(0,6)=='value_' && e[i].type=='hidden')

e[i].value = '';
else

e[i].value = '';

}

}
ShowHideControls();

return false;

}



After regenerating the project, I am still getting no records found after I cleared the form and press search.

Hi,

thank you for pointing me to this bug.

We'll fix it with the next update of PHPRunner.

To get it working now modify search.php file in C:\Program Files\PHPRunner3.1\source folder

Find this snippet there:

and insert these lines just before:
Then rebuild your project.

Alexey admin 4/18/2007

Hi,
please apply modifications carefully.
The function should look like this:

function ResetControls()

{

var i;

e = document.forms[0].elements;

for (i=0;i<e.length;i++)

{

if (e[i].name!='type' && e[i].className!='button' && e[i].type!='hidden')

{

if(e[i].type=='select-one')

e[i].selectedIndex=0;

else if(e[i].type=='select-multiple')

{

var j;

for(j=0;j<e[i].options.length;j++)

e[i].options[j].selected=false;

}

else if(e[i].type=='checkbox' || e[i].type=='radio')

e[i].checked=false;

else

e[i].value = '';

}

else if(e[i].name.substr(0,6)=='value_' && e[i].type=='hidden')

e[i].value = '';
}
ShowHideControls();

return false;

}

M
mrpeeble author 4/18/2007

ok, that did it thanks

Hi,

please apply modifications carefully.
The function should look like this:

function ResetControls()

{

var i;

e = document.forms[0].elements;

for (i=0;i<e.length;i++)

{

if (e[i].name!='type' && e[i].className!='button' && e[i].type!='hidden')

{

if(e[i].type=='select-one')

e[i].selectedIndex=0;

else if(e[i].type=='select-multiple')

{

var j;

for(j=0;j<e[i].options.length;j++)

e[i].options[j].selected=false;

}

else if(e[i].type=='checkbox' || e[i].type=='radio')

e[i].checked=false;

else

e[i].value = '';

}

else if(e[i].name.substr(0,6)=='value_' && e[i].type=='hidden')

e[i].value = '';
}
ShowHideControls();

return false;

}