I have this problem, we have a form on our website that allows the user to input multiple names or companies, however one of the options is to remove the current fields, we use a hyperlink to do the job, it works fine in Fire Fox but not IE, can someone please help, if I need to post the script I will do so
Hyperlink works in Fire Fox but not in IE
Collapse
X
-
works in Fire Fox not IE
So here is my script, this is just one of the examples, they are all pretty similare so if I can fix this problem then I can go from their, the "remove" hyperlink is what this question refers to, I will highlight the text and if anyone can give me input that would be great, if further info is needed I will provide thanks
script language="javas cript">
/*
contains functions specific to this instance that is rendered from the partial
When this partial is rendered, we get a type (billto, party, etc) and sequence number
from the controller. We name all the functions around those two pieces to keep the function
unique. - rcaetano
*/
function selectRequestor _<%=@safe_descr iption%>(text, li)
{
new Ajax.Request('/dashboard/get_entity/' + li.id,
{ onSuccess: function(reques t) { setRequestor_<% =@save_descript ion%>(request.r esponseText); } } );
}
function setRequestor_<% =@save_descript ion%>(requestor )
{
data = requestor.split ("|")
document.getEle mentById("reque st_document<%=@ name_descriptio n%>[address]").value = data[1];
document.getEle mentById("reque st_document<%=@ name_descriptio n%>[city]").value = data[2];
document.getEle mentById("reque st_document<%=@ name_descriptio n%>[state]").value = data[3];
document.getEle mentById("reque st_document<%=@ name_descriptio n%>[zip]").value = data[4];
document.getEle mentById("reque st_document<%=@ name_descriptio n%>[phone]").value = data[5];
document.getEle mentById("reque st_document<%=@ name_descriptio n%>[fax]").value = data[6];
}
new Ajax.Autocomple ter("request_do cument<%=@name_ description%>[name]",
"autocomplete_c hoices",
"/dashboard/auto_complete_f or_entity_name" ,
{ afterUpdateElem ent : selectRequestor _<%=@safe_descr iption%> });
</script>
<table width="760" id="<%=@name_de scription%>">
<tr>
<td width="140">Nam e</td>
<td colspan="2">
<%= text_field_tag "request_docume nt#{@name_descr iption}[name]", nil, :size => 50 %>
</td>
<td align="right">[<a href="javascrip t:removePartial ('<%=@name_desc ription%>')">re move</a>]</td>
</tr>
<% if @name_type == "copylocation"% >
<tr>
<td>Records Type:</td>
<td colspan="3">
<%= select_tag "request_docume nt#{@name_descr iption}[record_type]",
options_for_sel ect(RecordType. titles)%>
</td>
</tr>
<% end %> -
Originally posted by acoderWelcome to TSDN!
Where's the removePartial function?
PS. I've merged the threads.
<script language="javas cript">
var current_name = "";
function removePartial(p artial_name)
{
var element = document.getEle mentById(partia l_name);
element.remove( 0);
}
</script>Comment
-
Originally posted by JlucateroThanks, but is their any other method by which to do this??
that's the standard way ... you remove your option-node from the element-node that contains it ... use this method, that is the common and best way to do such things ;)
an other way would be to create your html for your select-box (all the options that should appear in your box) as a primitive string with javascript and then you set the innerHTML-property of your select-node ... but that is the very beginner way ... and creates a lot of code ... and lines in your script ... i wouldn't recommend that method ...
kind regards ....Comment
Comment