I am loading a “category” value for an item from a database. Each time I load the data from the database into the form, I need the category drop down box to change based on the value returned from the load();
If I click on the item with id = 1
The info on file in the database is called and loaded into the form so I can make edits to the item’s information. This includes a “category” pulldown. The category changes for each item, so that drop down needs to change with is selected with each item I click from the dataview.
Yes. If category value is “MiniVan” in my database for ID #1, when I load the information into the form to edit that ID, I need the select dropdown to preload the MiniVan as the value for category on the FORM. (i.e., if I don’t want to make a change to the cateegory, when I save the form, it doesn’t revert back to the first option value on the select item)
Here’s the XML code for my edit Form.
As you can see, SUV is going to be the default value when the form loads because it is the first option, and I don’t have an option set as selected. I figured that begin as the rest of the items in the form prefilled with the value from the database as long as the item name and the database table name were the same that a select item would do the same. I’m trying to work on a fix using AJAX to pull the category and then change the value using
myForm.setItemValue(“category”, “MiniVan”);
however, I really believe there should be an easier more streamlined way to accomplish this. I hope I’m right!
well, I’ll be the first one to admit when I make a mistake…and I did.
I went back and checked the carDetails.php script that I was using to load the form and found that I wasn’t passing the category to the form from the php script.
Given this set me back a day on my programming, however, I did learn a lot about AJAX.
Thanks for the help, though.
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan