Skip to content

Instantly share code, notes, and snippets.

@mhenke
Created November 9, 2013 17:45
Show Gist options
  • Save mhenke/7387847 to your computer and use it in GitHub Desktop.
Save mhenke/7387847 to your computer and use it in GitHub Desktop.
awesome js function
function populateForEventProspectAdd () {
$('#CM_Name_' + document.FindCorporateMember.WhatRowAmIOn.value).val(document.EventProspectAdd.I_company_name.value);
$('#IM_First_' + document.FindCorporateMember.WhatRowAmIOn.value).val(document.EventProspectAdd.I_first_name.value);
$('#IM_Last_' + document.FindCorporateMember.WhatRowAmIOn.value).val(document.EventProspectAdd.I_last_name.value);
$('#IM_Address1_' + document.FindCorporateMember.WhatRowAmIOn.value).val(document.EventProspectAdd.I_address1.value);
$('#IM_Address2_' + document.FindCorporateMember.WhatRowAmIOn.value).val(document.EventProspectAdd.I_address2.value);
$('#IM_City_' + document.FindCorporateMember.WhatRowAmIOn.value).val(document.EventProspectAdd.I_city.value);
$('#IM_State_' + document.FindCorporateMember.WhatRowAmIOn.value).val(document.EventProspectAdd.I_state.value);
$('#IM_Zip_' + document.FindCorporateMember.WhatRowAmIOn.value).val(document.EventProspectAdd.I_zip.value);
$('#IM_Zip4_' + document.FindCorporateMember.WhatRowAmIOn.value).val(document.EventProspectAdd.I_zip4.value);
$('#IM_Phone_' + document.FindCorporateMember.WhatRowAmIOn.value).val(document.EventProspectAdd.I_phone.value);
$('#IM_E_mail_' + document.FindCorporateMember.WhatRowAmIOn.value).val(document.EventProspectAdd.I_email_address.value);
// Set the Value to the concatenated string: #IM_ID#_#Name_ID#_#Link_ID#_#CM_ID##
selectValue = '0_0_0_0'; // Company and Person does not exist so everything should be 0's at this point
SelectName = document.EventProspectAdd.I_first_name.value + ' ' + document.EventProspectAdd.I_last_name.value + ' - ' + document.EventProspectAdd.I_company_name.value;
SelectRegistrantOutsideCompany ( selectValue, SelectName );
$("#prospect-dialog").dialog("close");
}
@mhenke
Copy link
Author

mhenke commented Nov 9, 2013

so much wrong. put aside not using jquery selectors.

document.FindCorporateMember.WhatRowAmIOn.value is called at least 11 times. please put this in a var so it doesn't have to go to the dom each time

@mhenke
Copy link
Author

mhenke commented Nov 9, 2013

document.EventProspectAdd is called at least 11 times, please put this in a var so it doesn't have to go into the dom each time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment