Jump to content

GetElementById not working for Autocomplete


Recommended Posts

Our database was created before formulas were allowed in tables.  Due to relationships, table restrictions and being live, I would like to fix this without using formulas.  I have a submit form that is creating a Work Order Number by concatenating the Equipment_VIN and Time Stamp.  In the form the Equipment_VIN is chosen by drop drop down from an equipment table.  The form works perfectly.  When I change the Equipment_VIN to autocomplete so the VIN numbers are easier to find the element of the VIN is no longer pulled by the script.  Anyone have an idea as to why this is happening?

 

Here is the script I am running in the footer.  The script points to an HTML block div that is called "won" for work order number.

<SCRIPT LANGUAGE="JavaScript">

function concatenate()
{

var position1 = document.getElementById("InsertRecordEquipment_VIN").value;

var position2 = '[@cbTimestamp]';

var allpositions = position1 +" "+ position2;

document.getElementById("InsertRecordWork_Order_Number").value = allpositions;
document.getElementById("won").innerHTML= "Work Order Number is: " + allpositions;
}

document.getElementById("Submit").onmouseover=concatenate;
</SCRIPT>

 

Link to comment
Share on other sites

2 hours ago, ChrisGoode said:

Our database was created before formulas were allowed in tables.  Due to relationships, table restrictions and being live, I would like to fix this without using formulas.  I have a submit form that is creating a Work Order Number by concatenating the Equipment_VIN and Time Stamp.  In the form the Equipment_VIN is chosen by drop drop down from an equipment table.  The form works perfectly.  When I change the Equipment_VIN to autocomplete so the VIN numbers are easier to find the element of the VIN is no longer pulled by the script.  Anyone have an idea as to why this is happening?

 

Here is the script I am running in the footer.  The script points to an HTML block div that is called "won" for work order number.

<SCRIPT LANGUAGE="JavaScript">

function concatenate()
{

var position1 = document.getElementById("InsertRecordEquipment_VIN").value;

var position2 = '[@cbTimestamp]';

var allpositions = position1 +" "+ position2;

document.getElementById("InsertRecordWork_Order_Number").value = allpositions;
document.getElementById("won").innerHTML= "Work Order Number is: " + allpositions;
}

document.getElementById("Submit").onmouseover=concatenate;
</SCRIPT>

 

Since Equipment_VIN is an autocomplete field, try using another syntax for getting value:

var position1 = document.getElementsByName("InsertRecordEquipment_VIN")[0].value;

Hope it helps

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...