On 14 Mar 2011, at 15:13, Ross Gardler wrote:

> On 14/03/2011 15:02, [email protected] wrote:
>> Author: scottbw
>> Date: Mon Mar 14 15:02:18 2011
>> New Revision: 1081411
>> 
>> URL: http://svn.apache.org/viewvc?rev=1081411&view=rev
>> Log:
>> Make sure the Freeder widget gets the right form input - though it still 
>> won't refresh properly yet
> 
> Clearly I did something funky with namuing between testing and committing, 
> although refreshing does work. But...
> 
> There is something strange about properties in widgets using JQueryMobile. I 
> was working on another widget the other night (this one housed elsewhere) and 
> found that property handling is quite broken.
> 
> I've not yet narrowed it down to an predictable behaviour but my current 
> observations are:
> 
> - the first time you change a property it works
> - the second time it may work, but usually does not
> - stepping through code shows the old data is being pulled from the widget 
> even though something different is displayed
> - re-deploying the widget makes no difference
> - rebooting the server sometimes makes a difference
> 
> As I say, I've not got it down to entirely predictable behaviour so take my 
> statements here with a pinch of salt when testing.

I think its to do with conflicting triggers - the form buttons in a JQM dialog 
have a default action to close the dialog (i.e. go back) even if you attach 
another behaviour, such as calling the submit() function. So you can end up 
with two events racing and your view being rendered before the property is set 
(etc). 

The workaround appears to be to use controls that don't automatically act like 
links and to set their data-role to "button" so JQM styles them appropriately. 
Feels like a bit of a hack but appears to work.

> 
> Ross
> 
> 
>> 
>> Modified:
>>     incubator/wookie/trunk/widgets/freeder/index.html
>>     incubator/wookie/trunk/widgets/freeder/scripts/properties.js
>> 
>> Modified: incubator/wookie/trunk/widgets/freeder/index.html
>> URL: 
>> http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/freeder/index.html?rev=1081411&r1=1081410&r2=1081411&view=diff
>> ==============================================================================
>> --- incubator/wookie/trunk/widgets/freeder/index.html (original)
>> +++ incubator/wookie/trunk/widgets/freeder/index.html Mon Mar 14 15:02:18 
>> 2011
>> @@ -54,7 +54,7 @@
>>              <form action="" method="post">
>>                              <div data-role="fieldcontain">
>>                                              <label for="feedURL">Feed 
>> URL:</label>
>> -                                            <input type="url" name="name" 
>> id="name"  />
>> +                                            <input type="url" 
>> name="feedURL" id="feedURL"  />
>>                                      </div>
>>                                      <div data-role="fieldcontain">
>>                                              <button type="submit" 
>> onClick="Properties.submitForm(this.form)" value="save-settings" 
>> name="save-settings">Save</button>
>> 
>> Modified: incubator/wookie/trunk/widgets/freeder/scripts/properties.js
>> URL: 
>> http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/freeder/scripts/properties.js?rev=1081411&r1=1081410&r2=1081411&view=diff
>> ==============================================================================
>> --- incubator/wookie/trunk/widgets/freeder/scripts/properties.js (original)
>> +++ incubator/wookie/trunk/widgets/freeder/scripts/properties.js Mon Mar 14 
>> 15:02:18 2011
>> @@ -21,7 +21,7 @@
>>  var Properties = {
>>      
>>      submitForm: function() {
>> -            var url = dwr.util.getValue("feedURL");
>> +            var url =  $("#feedURL").val();
>>              Widget.preferences.setItem("feedURL", url);
>>              Controller.update();
>>              $.mobile.changePage("#storiesIndex");
>> 
>> 
> 
> 
> -- 
> [email protected]
> @rgardler

Reply via email to