Does any one know how to create a field that would contain a number? Then everytime the doc is opened the Serial/Invoice Number field would advance by, let's say, 1.
And,
The other thing I'd like to create is a drop down box containing all the US states. Would anyone have these two scripts? Let me know, k. Thanks folks.
Incrementing a number:
You solution will depend upon how your form will be processed. You can use the global object and the subscribed method. Otherwise you need to link to a database and use ADBC.
The states drop down can be populated by JS. The following document level JS will populate a field called 'States'.
// function to load combo box or list box
function SetStates(sFieldName) {
//define an array of state name and abbreviation array
var aStateAbrev = new Array([' ', ' '],
['ALABAMA','AL'],
['ALASKA','AK'], ['AMERICAN SAMOA','AS'],
['ARIZONA', 'AZ'], ['ARKANSAS', 'AR'],
['CALIFORNIA', 'CA'], ['COLORADO', 'CO'],
['CONNECTICUT', 'CT'], ['DELAWARE', 'DE'],
['DISTRICT OF COLUMBIA', 'DC'],
['FEDERATED STATES OF MICRONESIA', 'FM'],
['FLORIDA', 'FL'], ['GEORGIA', 'GA'],
['GUAM', 'GU'], ['HAWAII', 'HI'],
['IDAHO', 'ID'], ['ILLINOIS', 'IL'],
['INDIANA', 'IN'], ['IOWA', 'IA'],
['KANSAS', 'KS'], ['KENTUCKY', 'KY'],
['LOUISIANA', 'LA'], ['MAINE', 'ME'],
['MARSHALL ISLANDS', 'MH'], ['MARYLAND', 'MD'],
['MASSACHUSETTS', 'MA'], ['MICHIGAN', 'MI'],
['MINNESOTA', 'MN'], ['MISSISSIPPI', 'MS'],
['MISSOURI', 'MO'], ['MONTANA', 'MT'],
['NEBRASKA', 'NE'], ['NEVADA', 'NV'],
['NEW HAMPSHIRE', 'NH'], ['NEW JERSEY', 'NJ'],
['NEW MEXICO', 'NM'], ['NEW YORK', ', NY'],
['NORTH CAROLINA', 'NC'], ['NORTH DAKOTA', 'ND'],
['NORTHERN MARIANA ISLANDS', 'MP'], ['OHIO', 'OH'],
['OKLAHOMA', 'OK'], ['OREGON', 'OR'],
['PALAU', 'PW'], ['PENNSYLVANIA', 'PA'],
['PUERTO RICO', 'PR'], ['RHODE ISLAND', 'RI'],
['SOUTH CAROLINA', 'SC'], ['SOUTH DAKOTA', 'SD'],
['TENNESSEE', 'TN'], ['TEXAS', 'TX'],
['UTAH', 'UT'], ['VERMONT', 'VT'],
['VIRGIN ISLANDS', 'VI'], ['VIRGINIA', 'VA'],
['WASHINGTON', 'WA'], ['WEST VIRGINIA', 'WV'],
['WISCONSIN', 'WI'], ['WYOMING', 'WY'],
['Armed Forces Africa, Canada, Europe, & Middle East', 'AE'],
['Armed Forces Americas', 'AA'],
['Armed Forces Pacific', 'AP']
) // end of array
//Insert array of states andabbreviations into the combobox
this.getField(sFieldName).setItems(aStateAbrev);
return true;
} // end SetStates function
// call the function for field named "States"
SetStates("States");
George Kaiser