Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    <select> <option> ... works in IE6... does not work in firefox

    Hi All,

    First of all, great forum. I have been using the search function for the past few days, and have learnt a lot from the excellent responses.

    As much as I dont want to start another ... "doesnt work in firefox, but works in IE6 thread"... i think i have to...

    anyway here is the problem....

    I am updating a few text fields based on the option that user will select.
    This update takes the values name11, address1, address2 (see fields in red ... in code below)
    ... etc and puts it into text fields.

    This works perfectly in IE6.
    But in firefox, the text fields are filled with "undefined" =/

    Code:
    <select id="OptSiteNO" onChange="javascript:setFromSiteValues();DirtyFlag();" <c:if test="${sessionScope.ReadOnly eq 'true'}"> class="readOnlyTextbox" readonly="readonly" disabled="disabled"</c:if>>
    	<option value="" selected>Select One</option>
    	
    	<c:forEach items="${fromSiteList}" var="fromSite">
    		<option value="<c:out value="${fromSite.site}" />"
    			<c:if test='${selectedFromSite.site eq fromSite.site }'> selected </c:if>	
                                    name11="nick"
    				address1="<c:out value="${fromSite.addressLine1}"/>"
                    		address2="<c:out value="${fromSite.addressLine2}"/>"
    		        	city="<c:out value="${fromSite.city}"/>"
    			        zip="<c:out value="${fromSite.zipCode}"/>"
    			        state="<c:out value="${fromSite.state}"/>"
    			        countryCode="<c:out value="${fromSite.countryCode}"/>" maxLength="10">
    			<c:out value="${fromSite.site}" />
    		</option>
    	</c:forEach>
    	
    	<option value="Add New Address">Add Address</option>
    </select>
    javascript function that takes the values and puts them in the text field...
    Code:
    function setFromSiteValues()
    	{
    		fromSiteSelectedIndex = document.getElementById('OptSiteNO').selectedIndex;
    		fromSiteSelectedOption = document.getElementById('OptSiteNO').options[fromSiteSelectedIndex];
    
    		document.new_shipment.txtSiteNO.value = fromSiteSelectedOption.value;
    		document.getElementById('txtFromName').value = fromSiteSelectedOption.name11;
    		document.new_shipment.txtFromAddress1.value = fromSiteSelectedOption.address1;
    		document.new_shipment.txtFromAddress2.value = fromSiteSelectedOption.address2;
    		document.new_shipment.txtFromCity.value = fromSiteSelectedOption.city;
    		document.new_shipment.txtFromZip.value = fromSiteSelectedOption.zip;
    		document.new_shipment.txtFromState.value = fromSiteSelectedOption.state;
    		document.new_shipment.txtFromCountry.value = fromSiteSelectedOption.countryCode;
    	}



    NOTE: from what I gathered from research (using the search button on this forum... ) the problem is mainly because of the way i have the option declared (something is not the way firefox wants it to be)

    please let me know if you need any more details.. (this is my first time seeking help on the net. so, sorry if i missed any details)

    thanks in advance
    -nick
    Last edited by slickfrvr; 01-12-2007 at 09:21 PM.

  • #2
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Do you happen to have a link to a test version of it that works in IE and not FF? I've never used JSTL plus don't have access to the information it uses to create the html page.

    That said, you could try changing

    fromSiteSelectedOption.name11

    to

    fromSiteSelectedOption.getAttribute("name11")

    and see if it makes a difference.

    david_kw

  • #3
    Banned
    Join Date
    Oct 2005
    Location
    I'm in GMT -5
    Posts
    314
    Thanks
    0
    Thanked 1 Time in 1 Post
    slickfrvr:

    I don't know what server language that is, but...

    The option tag, other than "selected", has just one attribute: value. You will need to string together the various data items, along with a "spacer", as a single "value" for that option. I used "|", as a spacer, below.

    Code:
    name11="nick" + "|" + address1="<c:out value="${fromSite.addressLine1}"/>" + "|" + address2="<c:out value="${fromSite.addressLine2}"/>" +"|" +city="<c:out value="${fromSite.city}"/>"  ... etc...
    Then you pass the value to your function, using "this.value", the function then "splits" the various items, at the spacer:

    Code:
    onchange="setFromSiteValues(this.value);DirtyFlag();"
    Code:
    function setFromSiteValues(nVal)
    	{
    		var itemVal = nVal.split("|");
    		document.new_shipment.txtSiteNO.value = itemVal[0];
    		document.getElementById('txtFromName').value = itemVal[1];
    		document.new_shipment.txtFromAddress1.value = itemVal[2]
                    ... etc...
             }


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •