View Full Version : Conditional visualization of form elements not working

09-26-2011, 11:29 AM
Hi all,
I had posted earlier on the NaN issue. I have worked some more on my test file. Basically I want the user to select an option depending on whether he/she has Paracetamol in syrup or drops form. Once this is selected, automatically a different div for syrup or for drops should be seen depending on what the user selected earlier.
After this on pushing the calculate button, the output should be appropriate depending on the strength of the solution either for drops or syrup.
I have put together what I think code that should work but it stubbornly refuses to do otherwise. I have attached the relevant file.
If it doesn't work, obviously there is something wrong but what it is eludes me.:confused:
Any help will be appreciated greatly,

09-26-2011, 12:08 PM
I'd like to suggest you to learn more tutorials on javascript, as your code shows very weak understanding.

Here is my modified version upon yours. I've tried to modify as little as possible. You may need beyond compare or other file differ tools to see complete change points.

I've only tested it on firefox.

09-26-2011, 06:41 PM
Thank you allister for helping me out.
It seems to be working well. The only hitch that I can see is that there is a dropdown list to right of the text box for strength of the formulation and on selecting any one, it does not automatically fill it in the text box but the user has to key it in herself. I shall try to work on that next.
Your suggestion of going through tutorials and poor understanding is right and I take it in the spirit that it was intended. I am going through tutorials but at the same time getting my feet wet with actual real life examples that I am developing for my own personal website.
My only defense is that I just started to learn Javascript. Different people have different ways of learning. Some will learn all the theory and then go on to actually experimenting with the stuff. I belong to the camp that like to plunge in and learn more from actually doing the stuff than just reading about it.
By reading the different problems that people are facing and the suggestions offered by experts, I find that I learn far more than going step by step through the structured tutorials that are available.
I dont think any one technique of learning is better. What works for one is good for that person.
Thanks again,

09-27-2011, 04:14 AM
OK, go on your own way. If there are still problems, we can communicate further.