This topic is locked

search field directly to edit page

10/10/2005 1:22:55 PM
ASPRunnerPro General questions
author

Hi,

I want to know how I can direct the results of the search field and get directly pointed to the edit page. Right now if i search it finds the record and I have the option to edit or view the result. Is there anyway I can search for a record and then have it go directly to the edit page? Thanks!

Sergey Kornilov admin 10/11/2005

Hi,
you can use Java Script to go directly to the edit page. You can insert the code snippet like following near Edit hyperlink into generated ..._list.asp file.

<% if Request("action")="Search" or Request("action")="AdvancedSearch" then %>

<script>

document.forms.editform.TargetPageNumber.value=<%=mypage%>;

    document.forms.editform.editid.value = '<%=EscapeQuotes(rs(strKeyField))%>';

    <% if strKeyField2<>"" then %>

    document.forms.editform.editid2.value = '<%=EscapeQuotes(rs(strKeyField2))%>';

    <% end if %>

    <% if strKeyField3<>"" then %>

    document.forms.editform.editid3.value = '<%=EscapeQuotes(rs(strKeyField3))%>';

    <% end if %>

    document.forms.editform.todo.value = 'view';document.forms.editform.submit();

</script>

<% end if %>