Hi,
I had a bit of javscript in my Form, which took the value of all of my text fields and updated them into a rich text field. This code worked perfectly, but I now need to change the code to update the values from Select fields instead. Instead of this I get nothing returned…
This is my original function for updating text from Input fields:
function record_changes()
{
var updated_details="";
totals_doc = document.frames["embedframe"].document;
m_inputs = document.getElementsByTagName("Input");
for(i=0;i<m_inputs.length;i++)
{
mstr = new String(m_inputs[i].id);
if(m_inputs[i].value!="0")
{
if(mstr.indexOf("Line")!=-1)
{
if(updated_details=="")
{
updated_details = mstr+"|" + m_inputs[i].value;
}else{
updated_details = updated_details + "~" + mstr+"|"+m_inputs[i].value;
}
}
}
}
totals_doc.all['LineUpdates'].value=updated_details;
totals_doc.forms[0].submit();
alert("Your NOOSE Document has been submitted");
}
And this is my attempt at converting it to update from Select fields instead:
function record_changes()
{
var updated_details="";
totals_doc = document.frames["embedframe"].document;
m_inputs = document.getElementsByTagName("Select");
for(i=0;i<m_inputs.length;i++)
{
mstr = new String(m_inputs[i].id);
if(m_inputs[i].options[m_inputs[i].selectedIndex].text!="x")
{
if(mstr.indexOf("Line")!=-1)
{
if(updated_details=="")
{
updated_details = mstr+"|" + m_inputs[i].value;
}else{
updated_details = updated_details + "~" + mstr+"|"+m_inputs[i].value;
}
}
}
}
totals_doc.all['LineUpdates'].value=updated_details;
totals_doc.forms[0].submit();
alert("Your NOOSE Document has been submitted");
}
Can anyone suggest why this isn’t working?