Page 1 of 1

Magic Files

Posted: 2013-09-28 15:20
by AhmedBR
Hi,

I am using the following Code in Magic Files and works very well:

Code: Select all

 document.observe('dom:loaded', function() {
$('NetWeight').observe('change', function() {
if(isNaN($('NetWeight')) || $('NetWeight') > $('MaxQuantity') || $F('NetWeight') < 0){
alert('Error on Net Weight!');
var elem = document.getElementById("NetWeight");
elem.value = "1";
$('NetWeight').focus();
}
});
});
My problem is I cannot set elem.value = $('MaxQuantity') no matter what I try.
Any ideas how to set elem.value to be equal to Max Quantity?

Thanks

Re: Magic Files

Posted: 2013-09-28 23:17
by AhmedBR
Found out the problem, but still no solution.
MaxQuantity is a lookup field and if its value was not set on load, it stays Undefined!
Got no idea how to solve this for now :?: :!:

Re: Magic Files

Posted: 2013-10-01 19:18
by AhmedBR
Solved the problem by creating another field that is not LOOKUP, and used it to do the comparison.
That is it.