//Populate the current form with values from the selected entry in the history combobox // triggered by the history combox onselchange event //--ind, index of the history function fill_form(ind){ var ctls, i, j, pgs, pg, r, f, m; //reference to the pages and loop each page pgs = ThisEvent.Object.Parent.Parent.Pages; for (i = 1; i < pgs.Count + 1; i++) { pg = pgs.Item(i);//current page //To change the values of a control, the page the control is on must be activated. //if it is not the first page, activate the page if (i > 1) { pg.Activate(); } //as the most recent entry is listed as the first item in the in the combox //To match the an item in the _history array using the index from the combox, the order need to be reversed. _history.reverse(); r = _history[ind];//get the record from the _history _history.reverse();//reverse it back to normal order //reference to all the controls on the current page and loop through them //to populate values from history ctls = pg.Controls; for (j = 1; j < ctls.Count + 1; j++) { //get the name of the control and filter out those not saved. m = ctls.Item(j).name.toLowerCase(); if (m.substr(0, 1) == _flag) { //if the control has ListIndex attribute, it must be a combobox if (ctls.Item(j).ListIndex) { ctls.Item(j).SetFocus(); ctls.Item(j).ListIndex = r[m]; } else { //if it is not a combobox, it should have a Value field. ctls.Item(j).Value = r[m] } } } } //Go back to the first page pgs.Item(1).Activate(); } Listing 3: The fill_form function //Populate the history control with previous entries //Triggered by Form onload event function draw_history(){ var ctl = ThisEvent.Object.Pages(_hctl.page).Controls(_hctl.ctl); //the history control var l = _history.length; ctl.Clear();//clear all existing items in it for (var i = 0; i < l; i++) { //populate the list, so that the last record are the first in the list r = _history[l - i - 1]; ctl.AddItem(r[_record], i);//add the item in the list } } Listing 4: Draw_history function Conclusion A fill-form-from-history tool was developed for ArcPad using JavaScript. The tool can be easily adapted for existing ArcPad applications in only two steps. The advanced features of JavaScript achieve more functionality with less and simpler code, making it an excellent choice for ArcPad customization. About the Author Mel Yuanhang Meng is the CAD/GIS manager for DLZ Ohio, an architectural and engineering consulting firm. He works in the field of water/ wastewater infrastructure design, maintenance, and modeling. His professional interests include asset management, field data collection, and Web-based GIS application development. He holds two master's degrees, one in geography and the other in environmental engineering, from the University of Cincinnati. More Information Working with ArcPad 7, a free Web course, and Customizing ArcPad, another Web course, are offered by Esri. Visit www.esri.com/training to enroll. 300,000 Esri Customers are within your reach. Advertise today! Maximum Exposure. Minimum Investment. For Rates and Media Kit, visit www.esri.com/arcuser or e-mail us at ads@esri.com. www.esri.com ArcUser