Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
And now it does nothing
Message
De
03/04/2013 12:29:30
 
 
À
Tous
Information générale
Forum:
Javascript
Catégorie:
Codage, syntaxe et commandes
Titre:
And now it does nothing
Divers
Thread ID:
01569918
Message ID:
01569918
Vues:
75
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
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform