DRW Submit Button...

1

116

I have a results section using a dropdown populated with years (2010, 2009,
etc) with a submit button. How can I have the results load based on the
default dropdown value when the page opens with out then need to click
submit? I tried <script type="text/javascript">
function clicksubmit()
{
document.forms[0].submit();
}
</script>
and added the function to 'Onload', but the screen seems to continuously
cycle.

David
 
S

Stefan B Rusynko

Try the tip at
http://blogs.msdn.com/lisawoll/archive/2004/06/22/162911.aspx
But add a default of selectedindex 0 , the as say first select list item

<script>
for (i = 0; i < document.forms[0].CategoryID.options.length; i++)
{
if (document.forms[0].CategoryID.options.value == "<%=request.form("CategoryID")%>")
{
document.forms[0].CategoryID.selectedIndex = i; break;
} else {
document.forms[0].CategoryID.selectedIndex = 0;
}
}
</script>

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


I have a results section using a dropdown populated with years (2010, 2009,
etc) with a submit button. How can I have the results load based on the
default dropdown value when the page opens with out then need to click
submit? I tried <script type="text/javascript">
function clicksubmit()
{
document.forms[0].submit();
}
</script>
and added the function to 'Onload', but the screen seems to continuously
cycle.

David
 
S

Stefan B Rusynko

My original suggestion won't work in the for next loop and won't auto submit the form
You are Probably better off setting a Default value when you set up the DBRW filtered results per step 6 in
http://support.microsoft.com/kb/235554

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


Try the tip at
http://blogs.msdn.com/lisawoll/archive/2004/06/22/162911.aspx
But add a default of selectedindex 0 , the as say first select list item

<script>
for (i = 0; i < document.forms[0].CategoryID.options.length; i++)
{
if (document.forms[0].CategoryID.options.value == "<%=request.form("CategoryID")%>")
{
document.forms[0].CategoryID.selectedIndex = i; break;
} else {
document.forms[0].CategoryID.selectedIndex = 0;
}
}
</script>

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


I have a results section using a dropdown populated with years (2010, 2009,
etc) with a submit button. How can I have the results load based on the
default dropdown value when the page opens with out then need to click
submit? I tried <script type="text/javascript">
function clicksubmit()
{
document.forms[0].submit();
}
</script>
and added the function to 'Onload', but the screen seems to continuously
cycle.

David
 
1

116

Thanks for the info. Regarding the default value. It is a year...meaning
next year 2011 would be the default. Can this be scripted?

David
 
1

116

Hello Stefan. Thanks for the info. Regarding the default value, this is a
'Year'. Can this be scripted? 2010 would not work for next year.

David
 
S

Stefan B Rusynko

Have you set the Default value to 2011 when you set up the DBRW filtered results per step 6 in the link I posted?


--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________


Thanks for the info. Regarding the default value. It is a year...meaning
next year 2011 would be the default. Can this be scripted?

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Programming issue... 2
textbox Disable on value.... 2
DRW Questions... 1
Script... 6
Function... 15
Dropdown events... 2
Script Question... 4
Database dropdown resets on submit 0

Top