close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How do you make a Dynamic Form auto populate fields?

Thread began 7/31/2009 9:11 am by tom92909 | Last modified 7/31/2009 11:01 am by Eric Mittman | 6715 views | 3 replies |

tom92909Beta Tester

How do you make a Dynamic Form auto populate fields?

I am using PHP and mySQL.

I have a fully functional DataAssist Insert form that inserts records into a mySQL table.

For the first two inputs on the form, I have separate dynamic combo boxes that read from 2 separate recordsets. These queries look for specific information from different tables. If the 1st combo box selection is chosen, it will change the options in the second combo box. When the 2nd combo box is selected, the data that is chosen will dynamically determine what will auto populate the remaining text boxes with initial values. The remaining form fields will not have initial values until the 2nd combo box is selected.

1st Combo Box to get the Name for Table1

<select size="1" id="name" name="name">
<option value="-1" selected>Not Selected</option>
<?php
do {
?>
<option value="<?php echo $row_getTable1['record_id']; ?>"><?php echo $row_getTable1['name']; ?></option>
<?php
} while ($row_getTable1 = mysql_fetch_assoc($getTable1));
$rows = mysql_num_rows($getTable1);
if($rows > 0) {
mysql_data_seek($getTable1, 0);
$row_getTable1 = mysql_fetch_assoc($getTable1);
}
?>
</select>



2nd Combo Box to get the Department for Table2

<select size="1" id="department" name="department">
<option value="-1" selected>Not Selected</option>
<?php
do {
?>
<option value="<?php echo $row_getTable2['record_id']; ?>"><?php echo $row_getTable2['department']; ?></option>
<?php
} while ($row_getTable2 = mysql_fetch_assoc($getTable2));
$rows = mysql_num_rows($getTable2);
if($rows > 0) {
mysql_data_seek($getTable2, 0);
$row_getTable2 = mysql_fetch_assoc($getTable2);
}
?>
</select>



How is this accomplished?

Sign in to reply to this post

Eric Mittman

Getting your two combo boxes to work together so that the second is dependent on the first can be accomplished using the WebAssist Dynamic Dropdowns tool. It will allow you to create a dynamic client side array for the second select list that will be filtered based on your selection from the first select list. You could do this manually also, you would need to craft the js code to create an array like this and the code to filter and populate based on the selection. If you own any of the development suites then you probably already own this tool.

The final part where you populate the other form elements based on second selection will be more custom though, you would need to make sure you have an array of all the records and values for them then filter it based on the second list.

Sign in to reply to this post

tom92909Beta Tester

Eric,

Thanks for pointing me in the right direction. Yes I have the Super Suite, but that is one product that I've never used.

I'll download it and see what I can accomplish.

Thanks again! :)

Sign in to reply to this post

Eric Mittman

After you install the tool you should go to the help within Dreamweaver for an example of the functionality and see how it is accomplished. Let us know if you have any troubles.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...