Ticket #5424 (new defect)

Opened 7 months ago

Last modified 9 days ago

page refresh erases input values (dijit.form.FilteringSelect)

Reported by: ksmeltzer@… Owned by:
Priority: normal Milestone: 2.0
Component: Dijit Version: 1.0
Severity: normal Keywords: FilteringSelect overwriting input
Cc:

Description (last modified by bill) (diff)

When adding a dijit.form.FilteringSelect? to a page if there is an HTML input after the Filtering select it will overwrite the value of the input if the page is refreshed. Any input above the control will be fine but the value of the input directly after the Filtering select will be overwritten. Further after some debugging I have found that if you give the FilteringSelect? control a name value e.g. name="fselect" it will stop overwriting the input's value with the selected value and just blank out the input's value. This only seems to be an issue in firefox. As well both FilteringSelect? and ComboBox? do not default back to the selected value after refresh in both IE 7 and firefox 2. To reporduce the issue, use the HTML below, populate the inputs with test, select an option in the FilteringSelect? and refresh the page with the browser refresh; you should see that the bottom input has the value of the selected item.

Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11

HTML to reproduce issue:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
    <head>
        <style type="text/css">
            
            @import "http://o.aolcdn.com/dojo/1.0.2/dojo/resources/dojo.css";
            @import "http://o.aolcdn.com/dojo/1.0.2/dijit/themes/tundra/tundra.css";
            
        </style>
    </head>
    <body class="tundra">
        <script type="text/javascript" src="http://o.aolcdn.com/dojo/1.0.2/dojo/dojo.xd.js.uncompressed.js"></script> 

        <script type="text/javascript">
            
                        djConfig = {
                parseOnLoad: true,
                isDebug: false,
                usePlainJson: true
            };
            dojo.require("dijit.form.FilteringSelect");
            dojo.require("dojo.parser");
			
                       
        </script>
        <input maxlength= "30" size= "30" id= "atextboxbefore">
		<br>
		<select id="aselectbox" dojotype= "dijit.form.FilteringSelect" autocomplete= "true">
			<option value="a">a</option>
			<option value="b">b</option>
		</select>
		<br>
		<input maxlength= "30" size= "30" id="atextboxafter">
    </body>
</html>

Attachments

test.html (1.2 kB) - added by guest 7 months ago.

Change History

Changed 7 months ago by guest

Changed 7 months ago by bill

Hi. Hmm, I'm not sure what the rules are for refreshing at all. It seems normal to me that when you refresh a page all the data you've entered will be erased, but maybe it's per browser? Is there an official spec on what's supposed to happen?

Changed 7 months ago by guest

I am not sure if there is an official spec but it is expected behavior in all of the browsers. If you remove the DojoType? attribute from the select element and refresh the page in either IE, Firefox, Safari or Opra it will retain the selected value upon refresh as well the inputs will retain their value. I will see if I can dig up whether or not it is an official spec.

Looking at the DOM tree I can see that the control is writing the following elements to the browser.

<table id="widget_aselectbox" class="dijit dijitReset dijitInlineTable dijitLeft dijitComboBox" cellspacing="0" cellpadding="0" wairole="presentation" dojoattachevent="onmouseenter:_onMouse,onmouseleave:_onMouse" name="aselectbox" role="wairole:presentation" widgetid="aselectbox" style="">
	<tbody>
		<tr class="dijitReset">
			<td class="dijitReset dijitStretch dijitInputField" width="100%">
				<input id="aselectbox" class="" type="text" wairole="combobox" dojoattachpoint="textbox,focusNode" dojoattachevent="onkeypress, onkeyup, onfocus, compositionend" 						autocomplete="off" role="wairole:combobox" tabindex="0" value="" aaa:valuenow="a" aaa:invalid="false" aaa:disabled="false" style=""/>
				<!--Right here--><input type="text" value="" style="display: none;" name="aselectbox"/>			</td>
			<td class="dijitReset dijitValidationIconField" width="0%">
			</td>
			<td class="dijitReset dijitRight dijitButtonNode dijitDownArrowButton" width="0%" dojoattachevent="onmousedown:_onArrowMouseDown,onmouseup:_onMouse,onmouseenter:					_onMouse,onmouseleave:_onMouse" dojoattachpoint="downArrowNode">
			</td>
		</tr>
	</tbody>
</table>

If you look where I put the comment “<!--Right here-->” you will notice that their is a input written by the widget that has no id associated with it. I am assuming that DOJO is using this input to preserve the last selected value since it has style="display: none;". I think that maybe because it does not have an id DOJO is getting confused as to which input it is looking for. This is only a hypothesis. If someone can point me in the right direction I would be more that happy to try to create a patch but I am not intricate familiar with how the ComboBox? / FilteringSelect? controls work on a display and post back level.

Changed 7 months ago by bill

  • cc ksmeltzer@… removed
  • reporter changed from guest to ksmeltzer@gmail.com

We have two inputs because one shows the displayed value (ex: California) and one holds the actual value that gets submitted (ex: CA). We could probably add an id attribute to the hidden <input> without incident, and I guess that would solve the problem originally listed in this bug report, but I don't think it would make page reloading work as you described, because although the hidden input would be populated with the right value (same value as before the refresh), the widget wouldn't realize what had happened. The widget would think it's value was the one specified in the page markup.

Sounds like this would be solved by the "stabile" code from 0.4, which serialized and deserialized widget values when using the back/forward button.

Feel free to ping me on the #dojo IRC channel (I'm wildbill.)

Changed 6 months ago by doughays

Firefox will not fill in the last native input if you specify autoComplete="off" on it. I think firefox is just getting confused by the number of input's changing.

Changed 5 months ago by bill

  • summary changed from dijit.form.FilteringSelect overwriting html input elements. to page refresh erases input values (dijit.form.FilteringSelect)
  • milestone set to 2.0

Marking for 2.0 for consideration.

Changed 5 months ago by alex

  • milestone changed from 2.0 to 1.3

Milestone 2.0 deleted

Changed 4 months ago by bill

  • milestone changed from 1.3 to 2.0

Changed 9 days ago by bill

  • description modified (diff)

See also #6920.

Note: See TracTickets for help on using tickets.