So i am pretty new to Gravity forms so here's my question...
I created a form and now i have a couple of business names (which I have put in my mysql) that i am trying to get to prepopulate some of the fields when the user chooses a certain field in a drop down list. It works to a certain extent of grabbing the data but when it goes to the form, all the prepopulated data comes out as "undefined"
here is my code
<style>
.gv-list-container
{
display:block !important;
}
</style>
[gravityview id="425" page_size="100" lightbox="0"]
[atl_webservice level="3"]service request[/atl_webservice]
<script>
function getFieldValue(fieldClassName)
{
var url = window.location.href;
if (url.indexOf('gv_search') > -1 )
{
if (document.getElementsByClassName(fieldClassName).length > 0)
{
var fieldHTML = document.getElementsByClassName(fieldClassName)[0].innerHTML;
fieldValue = fieldHTML.split("span>");
//alert(fieldValue[1]);
}
}
}
var firstName = getFieldValue("gv-field-3-10");
var lastName = getFieldValue("gv-field-3-11");
var emailAdress = getFieldValue("gv-field-3-4");
var phoneNumber = getFieldValue("gv-field-3-3");
document.getElementById("ContactFirstName").value = firstName;
document.getElementById("ContactLastName").value = lastName;
document.getElementById("ServiceContactEmail").value = emailAdress;
document.getElementById("ContactPhoneNumber").value = phoneNumber;
</script>
EDIT: So i figured out the issue with why it wasnt returning results...bc i had no return however when i grab the email field weird long script with