Keypad Entry Problem
All  1-2  3-6

Previous
Next
 From:  Michael Gibson
7012.3 In reply to 7012.1 
Hi Brian, also probably what is messing up your actual script is if you have characters like just a plain - or . as the text content in a NumericInput field, when you try to retrieve the .value property of that control you'll get the JavaScript 'undefined' value as the result rather than an actual number.

So another way to guard against this problem is to look if any of those fields have an 'undefined' value and bail out from further processing if that's the case.

That would be something like this:

code:
			function UpdateElastica()
			{
				if ( P.value === undefined || U.value === undefined || WD.value === undefined )
					return;


I think with this added in as the first line of the update function it should avoid your problem.

Before maybe your script is getting stuck in an infinite loop or something because it's expecting those values to be numbers but they're actually 'undefined'.

Please let me know if you still see any problems after adding this in.

- Michael

EDITED: 4 Nov 2014 by MICHAEL GIBSON

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
7012.4 In reply to 7012.3 
Thank you very much Michael.

Will try your answers.

I had tried NAN, which is incorrect :-)
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
7012.5 In reply to 7012.4 
Hi Brian, NaN was a good guess, but yeah 'undefined' is maybe a bit more universal which would maybe work with any kind of control even non-numeric stuff.

The other possibility was to throw an exception if you try to get the .value and there is no numeric representation of it... But that can be somewhat annoying to deal with as well.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  bemfarmer
7012.6 In reply to 7012.5 
Undefined works very well!

I have not observed any problems, so I will post _elastica2 under its topic.

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-2  3-6