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

If Else within Form

New Here ,
Jun 04, 2008 Jun 04, 2008
I am creating a form to add employees into an employee database. In the form I have 2 radio buttons displaying Office1 and Office2. If the user selects Office 1, then a droplist should appear displaying Departments for Office 1...the same goes for Office2 and its departments. How do I create this if else statement within a form before submission? Do I use Javascript? Thanks for the help..
475
Translate
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
Explorer ,
Jun 04, 2008 Jun 04, 2008
Do you want to use the if else to show your drop down list? if so, yes you need to use javascript.
Translate
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
New Here ,
Jun 04, 2008 Jun 04, 2008
Yes.. what I want is...If user selects Office1 show DepartmentList1. Else If user selects Office 2 show DepartmentList2.
Translate
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 ,
Jun 04, 2008 Jun 04, 2008
The concept is similar to Related Selects. (seems to be the theme of the day). Here's how I once did it. http://www.pathcom.com/~bracuk/code/RelatedSelects.htm .
Translate
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
New Here ,
Jun 04, 2008 Jun 04, 2008
LATEST
As always, it depends.

You don't need Javascript, unless you want a page reload without someone clicking submit. If you preload everything to the web browser before with Javascript, you don't need AJAX. If you want in-line updates without reloading the entire page and pre-populating Javascript, you need AJAX.

So it can be done any which way...the way you want the user to interact with the site is what determines the route. Chances are, Javascript is a necessity.

AJAX in this case is often the most user friendly, though it should degrade gracefully (work without Javascript). Tools like JQuery make it easy and fun, but it does get funky thinking the degradable way.
Translate
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