readonly vs. hidden, simplifying java, global organization of adobe form
hello,
i new java , adobe acrobat. have form in clients separated 3 types , depending on type of client areas of form not need filled out. form unfortunately, long , complicated multiple scenarios example if individual investor vs. corporate investor different fields need filled out , if corporate investor , located in bc (both scenarios) different fields need completed. there quite few fields (50+) change , although code working (mostly) bulky , feel better thought through/organized/possibly using incorrect commands situation. question 2 fold: making text boxes, drop boxes, , radio buttons when best use hidden vs visible, , read-only true/false (and possibly other commands unaware of)? second question how simplify code prevent mistakes , make changes easier. @ moment finding change 1 thing , effects 4 other things didn't want effect. example, have 3 client types radio button individual, joint, corporation place code into each button if click through (change answer) opens right fields or better way think it. code right example individual choice:
{
var v = this.getfield("investortype").value;
if (v == "individual")
{
this.getfield("corptype").display = display.hidden;
this.getfield("salutation").display = display.visible;
this.getfield("surname").display = display.visible;
this.getfield("fname").display = display.visible;
this.getfield("street").display = display.visible;
this.getfield("city").display = display.visible;
this.getfield("province").display = display.visible;
this.getfield("postalcode").display = display.visible;
this.getfield("telephone").display = display.visible;
this.getfield("fax").display = display.visible;
this.getfield("email").display = display.visible;
this.getfield("occupation").display = display.visible;
this.getfield("birthdate").display = display.visible;
this.getfield("employer").display = display.visible;
this.getfield("sin").display = display.visible;
this.getfield("license").display = display.visible;
this.getfield("birthcert").display = display.visible;
this.getfield("passport").display = display.visible;
this.getfield("salutation_j").display = display.hidden;
this.getfield("surname_j").display = display.hidden;
this.getfield("fname_j").display = display.hidden;
this.getfield("street_j").display = display.hidden;
this.getfield("city_j").display = display.hidden;
this.getfield("province_j").display = display.hidden;
this.getfield("postalcode_j").display = display.hidden;
this.getfield("telephone_j").display = display.hidden;
this.getfield("fax_j").display = display.hidden;
this.getfield("email_j").display = display.hidden;
this.getfield("occ_j").display = display.hidden;
this.getfield("birthdate_j").display = display.hidden;
this.getfield("employer_j").display = display.hidden;
this.getfield("sin_j").display = display.hidden;
this.getfield("license_j").display = display.hidden;
this.getfield("birthcert_j").display = display.hidden;
this.getfield("passport_j").display = display.hidden;
this.getfield("name_c").display = display.hidden;
this.getfield("address_c").display = display.hidden;
this.getfield("city_c").display = display.hidden;
this.getfield("province_c").display = display.hidden;
this.getfield("postalcode_c").display = display.hidden;
this.getfield("telephone_c").display = display.hidden;
this.getfield("fax_c").display = display.hidden;
this.getfield("email_c").display = display.hidden;
this.getfield("principalbus").display = display.hidden;
this.getfield("bin").display = display.hidden;
}
else if (v== "joint")
{
this.getfield("salutation").display = display.visible;
this.getfield("surname").display = display.visible;
this.getfield("fname").display = display.visible;
this.getfield("street").display = display.visible;
this.getfield("city").display = display.visible;
this.getfield("province").display = display.visible;
this.getfield("postalcode").display = display.visible;
this.getfield("telephone").display = display.visible;
this.getfield("fax").display = display.visible;
this.getfield("email").display = display.visible;
this.getfield("occupation").display = display.visible;
this.getfield("birthdate").display = display.visible;
this.getfield("employer").display = display.visible;
this.getfield("sin").display = display.visible;
this.getfield("license").display = display.visible;
this.getfield("birthcert").display = display.visible;
this.getfield("passport").display = display.visible;
this.getfield("salutation_j").display = display.visible;
this.getfield("surname_j").display = display.visible;
this.getfield("fname_j").display = display.visible;
this.getfield("street_j").display = display.visible;
this.getfield("city_j").display = display.visible;
this.getfield("province_j").display = display.visible;
this.getfield("postalcode_j").display = display.visible;
this.getfield("telephone_j").display = display.visible;
this.getfield("fax_j").display = display.visible;
this.getfield("email_j").display = display.visible;
this.getfield("occ_j").display = display.visible;
this.getfield("birthdate_j").display = display.visible;
this.getfield("employer_j").display = display.visible;
this.getfield("sin_j").display = display.visible;
this.getfield("license_j").display = display.visible;
this.getfield("birthcert_j").display = display.visible;
this.getfield("passport_j").display = display.visible;
this.getfield("corptype").display = display.hidden;
this.getfield("name_c").display = display.hidden;
this.getfield("address_c").display = display.hidden;
this.getfield("city_c").display = display.hidden;
this.getfield("province_c").display = display.hidden;
this.getfield("postalcode_c").display = display.hidden;
this.getfield("telephone_c").display = display.hidden;
this.getfield("fax_c").display = display.hidden;
this.getfield("email_c").display = display.hidden;
this.getfield("principalbus").display = display.hidden;
this.getfield("bin").display = display.hidden;
}
else if (v=="corp")
function updateformfield()
{
var v = this.getfield("investortype").value;
if (v == "corp")
{
this.getfield("corptype").display = display.visible;
this.getfield("salutation").display = display.hidden;
this.getfield("surname").display = display.hidden;
this.getfield("fname").display = display.hidden;
this.getfield("street").display = display.hidden;
this.getfield("city").display = display.hidden;
this.getfield("province").display = display.hidden;
this.getfield("postalcode").display = display.hidden;
this.getfield("telephone").display = display.hidden;
this.getfield("fax").display = display.hidden;
this.getfield("email").display = display.hidden;
this.getfield("occupation").display = display.hidden;
this.getfield("birthdate").display = display.hidden;
this.getfield("employer").display = display.hidden;
this.getfield("sin").display = display.hidden;
this.getfield("license").display = display.hidden;
this.getfield("birthcert").display = display.hidden;
this.getfield("passport").display = display.hidden;
this.getfield("salutation_j").display = display.hidden;
this.getfield("surname_j").display = display.hidden;
this.getfield("fname_j").display = display.hidden;
this.getfield("street_j").display = display.hidden;
this.getfield("city_j").display = display.hidden;
this.getfield("province_j").display = display.hidden;
this.getfield("postalcode_j").display = display.hidden;
this.getfield("telephone_j").display = display.hidden;
this.getfield("fax_j").display = display.hidden;
this.getfield("email_j").display = display.hidden;
this.getfield("occ_j").display = display.hidden;
this.getfield("birthdate_j").display = display.hidden;
this.getfield("employer_j").display = display.hidden;
this.getfield("sin_j").display = display.hidden;
this.getfield("license_j").display = display.hidden;
this.getfield("birthcert_j").display = display.hidden;
this.getfield("passport_j").display = display.hidden;
}
}
}
updateformfield()
is there way simplify this? appreciated! apologies wall of text.
when need control group of fields, it's idea use hierarchical field naming simplify code. example, instead of "salutation_j", "surname_j", etc., use "j.salutation", "j.surname", etc., , can hide of j fields single statement:
getfield("j").display = display.hidden;
the code posted has other problems, easier deal after you've made changes allow simplification.
More discussions in JavaScript
adobe
Comments
Post a Comment