SID-02297: Populating data dynamically in forms
Status: |
Asked |
TWiki version: |
6.0.1 |
Perl version: |
|
Category: |
CategoryForms |
Server OS: |
Linux |
Last update: |
7 years ago |
Hello,
I am using twiki forms to get user input. My form has select fields. Based on user selection I need to ppopulate data in another dropdown and so on. I tried javascript onChange() to populate new data on selecting an option from list. But not able to populate list run time.
Could someone help by providing sample code to do the same?
Thanks in advance.
--
TWiki Guest - 2017-02-15
Discussion and Answer
Are you saying that javascript you created works but doesn't work when the page first loads?
If so try using
<body onload="myFunction()">
to run your javascript function when the page body finishes loading.
--
Jani Hamalainen - 2017-02-20
Thanks. This is now working. But these dynamically populated form fields ( select options) are later not available when a topic is created on submit of this html form. Template is used to create a topic. Could you please suggest?
--
TWiki Guest - 2017-02-20
If what you are trying to do is working in one topic but not in another topic that is based on a template the best thing to do is compare the 'working' topic and the 'non-working' topic. Without seeing the comparison it's hard to point you in a more specific direction but I think the problem will be apparent when you compare.
--
Jani Hamalainen - 2017-02-20
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.