Bit of a programming newb, so be nice
I am developing a small app in Joomla! where I need to sequentially number file folders. On the page where I add new folders I have a select menu to select the type of folder. In this case, either Action, Reference, or Archive. What I want to have happen is after I select the type of folder, I want to enter the next available number in the form field. I realize to do this without resubmitting the page I need to use javascript and onchange. The problem is I am almost clueless when it comes to javascript (I am working on it though) so I need some help. This is what I have.
<fieldset class="adminform">
<legend><?php echo JText::_( 'Folders' ); ?></legend>
<table class="admintable">
<tbody>
<tr>
<td width="20%" class="key"><label for="Type"><?php echo JText::_( 'Folder Type' ); ?>:</label>
</td>
<td><?php echo $lists['FolderType'];?></td>
</tr>
<tr>
<td width="20%" class="key"><label for="FolderNumber"><?php echo JText::_( 'Folder Number' ); ?></label>
</td>
<td><INPUT type="text" name="FolderNumber" id="FolderNumber" value="<?php echo $row->FolderNumber;?>"></td>
</tr>
<tr>
<td width="20%" class="key"><label for="Location"><?php echo JText::_( 'Location' ); ?></label>
</td>
<td><?php echo $lists['Location']?></td>
<td></td>
</tr>
<tr>
<td width="20%" class="key"><label for="MaxFiles"><?php echo JText::_( 'Max Files' ); ?></label>
</td>
<td><INPUT type="text" name="MaxFiles" id="MaxFiles" value="<?php echo $row->MaxFiles;?>"></td>
</tr>
</tbody>
</table>
</fieldset>
I have the last folder numbers entered for each type of file folder stored in an array $foldernumbers. My select menu looks like this.
<select name="FolderType" id="FolderType" class="inputbox" ><option value="-1" >Select a Folder Type</option>
<option value="0" >Action</option>
<option value="1" >Reference</option>
<option value="2" >Archive</option>
</select>
I assume I have to pass my php array into a javascript array then call that based on my select menu. Only I have no clue how to go about doing that.
Thanks in advance for any assistance.
Mike