This topic is locked

Initial Search Dropdown

4/13/2012 12:26:41 AM
PHPRunner General questions
P
prattster1874 author

Does anyone know if it is possible to set a default initial value in the search panel of a list page?
I have a list that contains records that span over multiple years. I would like the search panel "Year" field to default to the current year.
Searched the forums but couldn't find an answer.
Thanks,

C
cgphp 4/13/2012

In the "Javascript onload" event of the List page, enter the following code:

var d = new Date();

var year = d.getFullYear();

$("#ctlSearchFor1").val(year);
P
prattster1874 author 4/17/2012



In the "Javascript onload" event of the List page, enter the following code:

var d = new Date();

var year = d.getFullYear();

$("#ctlSearchFor1").val(year);



Thanks for the reply - I can't get it to work though? Do you need to "capture" the control? Sorry I am pretty hopeless at Javascript!!!! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=65623&image=1&table=forumreplies' class='bbc_emoticon' alt=':blink:' />

C
cgphp 4/19/2012

What do you mean when you say "Do you need to "capture" the control?"