If the form does not contain <input type=file /> this is possible. Perhaps 
something like this?

<form>
  <div><input type="text" name="a" /></div>
  <div>
    <input type="submit" value="Submit" id="g" />
  </div>
</form>

<script>
var ser_form = null;
jQuery(function() {
   var myform = Query('form');
   ser_form = myform.serialize();
   myform.submit(function() {
      if(ser_form == myform.serialize()) {
         alert('form not changed, not submitting');
         return false;
      else {
         alert('form changed, submitting');
         return true;
      }
   });
}
</script>



On Sunday, 9 December 2012 21:59:55 UTC-6, Joe Barnhart wrote:
>
> Wow, I wish I could mark all of you as "best answer."
>
> Massimo -- I was thinking at lunch and wondered if I can calculate the 
> same hash function on the form vars in the browser.  I suppose I could at 
> least create a server callback that takes the form.vars and uses the same 
> hashing function to create a hash to compare with the one in the form.  Is 
> there an easy way to assemble the same values in the same order as the 
> SQLFORM helper just using client-side javascript?  That would make it 
> easier to pass to the controller to hash and compare to the original form 
> hash.  (I'd like to do it client-side but Javascript implementations of MD5 
> might be biting off a little too much.)  Would that be easier than 
> comparing each item, given that I have probably 50 or more items in this 
> form?
>
> I could use the callback to set a visual "badge" when something had 
> changed on the form as well as pop up Niphlod's ugly dialog to prevent the 
> user from navigating away and losing his work.  Maybe I'll go Paolo one 
> better and make the Submit button blink colors!  (That would probably land 
> my site in WebPagesThatSuck.com)
>
>
> -- Joe B.
>
>

-- 



Reply via email to