Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #26095

Re: Prevent Drop-downs from showing

From Joao Rodrigues <groups_jr-1@yahoo.com.br>
Newsgroups comp.lang.javascript
Subject Re: Prevent Drop-downs from showing
Date 2014-11-07 15:53 -0200
Organization Aioe.org NNTP Server
Message-ID <m3j0va$ro7$1@speranza.aioe.org> (permalink)
References <37302ad5-2e60-4a3a-ab43-9c3bbb95ac5c@googlegroups.com> <XnsA3DE5A5541384eejj99@194.109.133.133>

Show all headers | View raw


On 07-11-2014 05:52, Evertjan. wrote:
> DrKen <javajedi2@yahoo.com> wrote on 07 nov 2014 in comp.lang.javascript:
> 
>> I'm trying to modify a web page that uses hard-coded values in XML for
>> countries and states.  However, we are getting errors because users
>> might select a country from the country drop-down list, say, Australia,
>> but also choose a U.S. state.  Our main student information system,
>> PeopleSoft, chokes on invalid combinations like that, even though the
>> web page does not.  
> 
> Methinks using clientside to hide serverside coding errors is the wrong 
> approach.

The OP didn't mention any "serverside coding errors". I understood the
web application is using XML files (or XML data) to populate the
drop-down menus, but it could be using JSON instead. So he might write
some client-side JavaScript in order to prevent the odd combinations
between countries and states.

> 
>>    I'm no expert at JavaScript, and I would like a little guidance on
>>    how to check the country drop-down value as soon as it is selected.
> 
> use <select onchange='..'
> 
> [This part is just html]
>  
>>    If it is "Untied States" or "Canada," the user is allowed to pick a
>>    state. If it is any other country, which is unlikely,  I want to
>>    blank out any state value and prevent the state dropdown form
>>    appearing or if it is already visible, hide it. I know how to respond
>>    to the "Submit button," but this is more complex.  
> 
> It seems you know very little of scripting, 
> perhaps it would be better to hire a professional,
> or first learn more?

I hate terms like "professional", "engineer" that don't tell nothing
nowadays. For instance, see John Resig who created jQuery and wrote a
book called "Pro JavaScript Techniques", oh boy! Not happy with that
title, he wrote the "Secrets of the JavaScript Ninja" six years later...
If you use Resig's Pro techniques you'll become a real NINJA (no income,
no job, no asset).

> 
> To have an unexpected question pop up seems not nice to the user,
> better change from readonly to readwrite.
> 
> Even so serverside should be able to detect errors,
> and act accordingly.
>  
>> The drop-down for countries and states occur four times on one page:
>> current address, mailing address, birth country address, and employment
>> address.

Simply build the options for the States select (drop-down menu) based on
the Country's choice. After changing the country (onchange event
handler), the code empties the States dropdown and populates it again
with the corresponding options.

-- 
Joao Rodrigues

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Prevent Drop-downs from showing DrKen <javajedi2@yahoo.com> - 2014-11-06 19:34 -0800
  Re: Prevent Drop-downs from showing "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-11-07 08:52 +0100
    Re: Prevent Drop-downs from showing Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-07 13:56 +0100
    Re: Prevent Drop-downs from showing Joao Rodrigues <groups_jr-1@yahoo.com.br> - 2014-11-07 15:53 -0200
      Re: Prevent Drop-downs from showing "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-11-07 21:43 +0100
        Re: Prevent Drop-downs from showing Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-11-08 01:56 +0100
  Re: Prevent Drop-downs from showing Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-08 14:08 +0000
    Re: Prevent Drop-downs from showing Tim Streater <timstreater@greenbee.net> - 2014-11-08 18:08 +0000
      Re: Prevent Drop-downs from showing "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-11-08 19:47 +0100
        Re: Prevent Drop-downs from showing Denis McMahon <denismfmcmahon@gmail.com> - 2014-11-08 21:20 +0000

csiph-web