0

I made the following code to replace form fields in a page that I can't edit but only manipulate. However, the code does nothing. In chrome console when I print a variable it works fine. The code is below:

//GET val from drop DROP DOWN
var office_id = FieldIDs["OfficeName"];//Gets the input id
var offices;//gets the value from the drop down
$("#FIELD_"+office_id).change(function(){
    offices = $(this).val();
}).change();


//The below gets the id's of all the input fields
var address_id = FieldIDs["Address"];
var address2_id = FieldIDs["Address2"];
var city_id = FieldIDs["City"];
var state_id = FieldIDs["State"];
var zip_id = FieldIDs["Zip"];
var phone_4id = FieldIDs["Number4"];//phone
var phone_id = FieldIDs["Number1"];//fax
var pdfm4 = FieldIDs["pdfm4"];
var pdfm = FieldIDs["pdfm"];

if(offices == "SoCal Accounting"){
    $('#FIELD_'+address_id).val("7421 Orangewood Avenue");
    $('#FIELD_'+address2_id).val("");
    $('#FIELD_'+city_id).val("Garden Grove");
    $('#FIELD_'+state_id).val("CA");
    $('#FIELD_'+zip_id).val("92841");
    $('#FIELD_'+phone_4id).val("+1 714.901.5800");//phone
    $('#FIELD_'+phone_id).val("+1 714.901.5811");//fax
}

Edited by persianprez

2
Contributors
1
Reply
14
Views
4 Years
Discussion Span
Last Post by LastMitch
0

I made the following code to replace form fields in a page that I can't edit but only manipulate

I don't quite understand your question because what you ask doesn't really make sense.

Where is you html code that goes with your javascript?

If you didn't bother taking your time to post the html code than I'm not going spend my time to look at a code without it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.