javascript and php form

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
hi everyone,

this is not exactly php question, but I need to call javascript inside
php script. now the question:

<form name="myForm"....
<tr><td><select name="mySelect" onChange="recreate(myForm)"...

where recreate represent javascript function:

function recreate(form)
  var input=document.form.mySelect.value;


how can I create new objects inside myForm depending on mySelect value
? (I know how to enable them but it's more elegant to display them
based on previous selection inside mySelect)


Re: javascript and php form

@net wrote:
Quoted text here. Click to load it
You have to do it all within the Javascript - recreate() - based on the  
value of MySelect.

You can use Php to build the JavaScript function(s) / object(s), so all  
possible combinations are already within the source of the page, but the  
secondary select forms must be altered or made visible (or some other  
technique - use the DOM) via JavaScript. Php can not call Javascript. It  
runs on the server and is gone by the time the page loads in the client  

Once the page is on the browser, you need to use JavaScript to create  
the page dynamics. For the relevant JavaScript Google 'Dynamic Forms  
Select' or something similar.

The alternative is to reload the page - make a return trip to the server.

 Chuck Anderson • Boulder, CO

Site Timeline