[luci] value of another field

Ugur DOGRU udogru at ubicom.com
Thu Feb 11 12:21:21 CET 2010


Hi Jo,
Thanks for your answer. But, it didn't work. I get "attempt to compare 
number with nil"
for below code.
~ugur

--s:option(Value, "start", translate("start")).rmempty = true
start = s:option(Value, "start", translate("start"))
start.rmempty = true                                          
                                                               
limit = s:option(Value, "limit", translate("limit")) 
limit.rmempty = true                                                    
                                                               
function start:validate(value)                  
local dd = limit:value(self.section)            
        if tonumber(value) > 254 or dd > 254 then
                return false              
        end                               
                                            
        return value                                   
end                                       


Jo-Philipp Wich wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi.
>
>   
>> how can i get a value of a field in same page in a function?
>>     
>
> By calling it's :value() function, example:
>
> opt1 = s:option(Value, ...)
> opt2 = s:option(Value, ...)
>
> function opt2:validate(value)
> 	local opt1val = opt1:value(self.section)
> 	...
> end
>
>
> ~ JoW
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAktypP8ACgkQdputYINPTPNHowCgifa/tAazCZHsqHorbZ2zk2Tl
> nJwAn0KKjrYkwS1xr/WExCyxQs5QhqBC
> =YxPx
> -----END PGP SIGNATURE-----
> _______________________________________________
> luci mailing list
> luci at lists.subsignal.org
> https://lists.subsignal.org/mailman/listinfo/luci
>   



More information about the luci mailing list