On Jun 6, 2011, at 7:02 PM, jan smoot wrote:
Seems simple, but I’m missing something!
I want to have a pulldown list of states. So, I insert menu/list
item, title=statelist, name=Select a State and define the state
entries. For testing I am starting with 3 options:
Choice 1=Alabama, value=AL
Choice 2=Alaska, value=AK
Choice 3=Arizona, value=AR
Based on their choice, I want to print out the value selection (ie
AK) on the page. How do I do that? Do I need a GO button for some
reason?
If you are using JavaScript to drive this effect, then no, you don’t
necessarily need the button. You can use the onchange event on the
picker to fire the effect. However, you must have a “null” option as
the default, something like Please choose… as the first option in
the picker, otherwise anyone who selects the first state won’t fire
the onchange event – because the picker hasn’t been changed.
If you had an HTML box on the page somewhere, you could update it with
the value of the picker by using the Extended dialog to add this pair
of options (name and value, respectively)
onchange
document.findElementById('name_of_the_box').innerHTML =
this.options[this.options.selectedIndex].value
I also want to use the value, AL, as a lookup key in a php table. I
thought I’d use $statelist, but that doesn’t seem to work.
It’s been many years since PHP would just turn a form element value
into a variable like that. You’re going to need to set up a form, and
then in the form handler, you could access it like this (assuming you
set your form to POST rather than GET):
$statelist = $_POST['statelist'];
but only as long as you have named that field statelist using the
third tab from the left in the Inspector. The first tab does nothing
useful in this case.
Walter
Gotta be a simple syntax thing I’m missing. Thanks for any/all help
in advance.
Jan
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options