• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Complete Javascript/CSS Newbie

Supermercado

Diamond Member
I'm a total newbie when it comes to Javascript and it's necessary for something I'm trying to do. I want to have an HTML form that begins with a dropdown box (and a default selection) with 5 or 6 choices and the rest of the form below. When a new choice is made from the dropdown box, I want the form below to change a little bit. It will require slightly different information depending on what choice is made in the dropdown box. After that it's going to go off and do happy fun things with PHP and MySQL, all of which I can handle. I'm an extreme novice when it comes to Javascript and so far, I've not had much luck finding examples of this type of action on google. If anyone could help me out a bit or point me in the right direction, I'd greatly appreciate it. Thanks for reading.
 
Well, dynamic forms sounds like a good place to start 🙂 I'll take a closer look at that page in a little while and see what I can come up with. Thank you.

btw, did you already know about that page or did you google for it just now? I was googling to try and find stuff about this last night and couldn't find much of anything useful.
 
Originally posted by: SuperCommando
Well, dynamic forms sounds like a good place to start 🙂 I'll take a closer look at that page in a little while and see what I can come up with. Thank you.

btw, did you already know about that page or did you google for it just now? I was googling to try and find stuff about this last night and couldn't find much of anything useful.

I googled "javascript dynamic forms"
 
jgbishop: Thanks. That looks fairly straightforward and simple and I can hopefully modify it to suit my needs. Thanks for posting that. I hope it helps.

MrChad: Oh. Now I feel dumb 🙂 I was searching for all sorts of crazy things. I was probably being too specific, actually. I think between that link and the script that jgbishop posted I should probably be able to come up with what I'm looking for.

Thanks again to both of you.
 
Your link was brilliant, MrChad. I was able to modify one of the examples in it to do exactly what I want to do. Unfortunately, though, I've run into a problem. Not with the Javascript but with the positioning of the changing forms. I'm doing this using CSS and I don't know much more about CSS than I do about Javascipt, and rather than start a new thread for a different, but related, question, I'm going to just go ahead and edit the thread title and ask in this thread.

Problem Page

That's a link to the problem page. It's going to be a database for a bunch of short stories a friend and I have written, so excuse the silly nature of the site 😛

Anyway, though, the dynamic form works great and I can change back and forth between all the different options. If you try and change any of them, I think you'll immediately see the problem. When I change from character to vehicle, the character form disappears as it should and the vehicle form appears as it should, but it's further down the page. I tried goofing around with position: absolute in the CSS of the div ids. That's how it was done on the example that MrChad posted. That works... but there's a slight problem. The border that surrounds the area where all the forms are is supposed to contain the forms, no matter which one is displayed at the time. If I change it to absolute positioning, the forms overlap the border and run down into the section where the copyright information is. Basically, I need a way to have the form divs stay within the content_box div and what I've tried with my limited CSS knowledge has failed so far.

I don't know if that makes sense at all. I hope there's a way to do what I'm wanting to do.

Thanks for reading and putting up with a newb 🙂
 
Back
Top