• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

setting List Menus

LEGEND ,
Apr 25, 2007 Apr 25, 2007

Copy link to clipboard

Copied

Hi Again All

Here's my problem. I need an onclick or onchange event to reset the opposite
form to the first value in the list.
E.G.

if I select Option 1 from FORM1 then go to FORM2 I need FORM 2 to trigger an
event that resets FORM1 back to 0 or the first element in it's list

<select name="FORM1">
<option value="0" selected="selected">Option 0</option>
<option value="1" selected="selected">Option 1</option>
<option value="2" selected="selected">Option 2</option>
</select>

<select name="FORM2">
<option value="0" selected="selected">Option 0</option>
<option value="1" selected="selected">Option 1</option>
<option value="2" selected="selected">Option 2</option>
</select>

I'm guessing a javascript solution would be easy but not for me :-).
Actually, if anyone knows of a cfscript solution that would be great.

TIA

Bill


TOPICS
Advanced techniques

Views

274

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 25, 2007 Apr 25, 2007

Copy link to clipboard

Copied

Like this,

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 26, 2007 Apr 26, 2007

Copy link to clipboard

Copied

You don't want cfscript because it would require a trip back to the server. You can use javascript to reset the selected index of the opposite list object. Something like this

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 26, 2007 Apr 26, 2007

Copy link to clipboard

Copied

LATEST
Thanks guys.

That worked perfectly.

Bill


"cf_dev2" <webforumsuser@macromedia.com> wrote in message
news:f0plkg$4o2$1@forums.macromedia.com...
> You don't want cfscript because it would require a trip back to the
> server.
> You can use javascript to reset the selected index of the opposite list
> object.
> Something like this
>
>
>
> <script type="text/javascript">
> function selectFirstListItem(listId) {
> var listObj = document.getElementById(listId);
> //javascript indexes are zero based. 0 is the index of the
> first list item
> listObj.selectedIndex = 0;
> }
> </script>
> <form>
> <select name="LIST1" id="list1" onFocus="selectFirstListItem('list2');">
> <option value="0" selected="selected">Option 0</option>
> <option value="1">Option 1</option>
> <option value="2">Option 2</option>
> </select>
>
> <select name="LIST2" id="list2" onFocus="selectFirstListItem('list1');">
> <option value="0" selected="selected">Option 0</option>
> <option value="1">Option 1</option>
> <option value="2">Option 2</option>
> </select>
> </form>
>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation