Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
And now it does nothing
Message
From
03/04/2013 12:41:10
 
 
To
03/04/2013 12:29:30
General information
Forum:
Javascript
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01569918
Message ID:
01569925
Views:
46
the href gets set but is there anything that actually calls the function?

I mean, the value of the link is set correctly but doesn't there have to be something calling the link in the html?
Maybe the variable needs to resolve first.

var foo = 'go.hcn?hcn2~recipe~'+topiclist.options[topiclist.selectedIndex].value;
window.location.href = foo';

>Hello all
>
>New job, new 'interesting' things.
>
>We've got a page that displays a 'Recipe of the Week' which will allow you to select different recipes from a dropdown. The first item in the dropdown is 'Select Topic' and it has an assigned value of 0. The other entries have an assigned value of an ID field in a table.
>
>When "Select Topic" is selected, the page reports an error and logs you out, mostly because the Fox code behind it is doing a "Locate for ID = ID of what was selected and then does an EOF() check. If EOF(), error and log out.
>
>Figured the best way to fix this was to put the following if stmt around the call.
>
>function SCDropDown(topiclist)
>  {
>  If topiclist.options[topiclist.selectedIndex].value > 0
>    {
>    location.href='go.hcn?hcn2~recipe~'+topiclist.options[topiclist.selectedIndex].value;
>    }
>  else
>    {
>    messageBox("Please select a Recipe")
>    }
>  }
>/SCRIPT
>** Brokets removed so you don't have to scroll halfway across the page
>
>form action="go.hcn?hcn2~recipe" method="POST" name='scope'
>SELECT NAME="topiclist" onchange="SCDropDown(this)" 
>OPTION VALUE="0" Select Topic
>OPTION VALUE="172" Antipasto Pita
>OPTION VALUE="19" Anytime Breakfast Burrito
>OPTION VALUE="118" Apple Pie Smoothie
>OPTION VALUE="157" Asian Chicken Salad
>OPTION VALUE="176" Asian Peanut Spring Roll
>and so forth
>
>
>And the good news is, it doesn't error/log when "select Topic" is selected.
>...the bad news....it doesn't do anything at all.
>
>Now, I've never claimed to be a Java-master and shan't be attempting to claim it for QUITE a while, but it seems to me that the if stmt is saying:
>If selectedIndex > 0
> display the information
>else
> throw up idiot box
>
>Is anyone seeing anything other than that?
>
>Thanks
>D


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform