[luci] How to perform data integrity checking?

Andrew Grove grove_andrew at hotmail.com
Wed Nov 4 00:09:29 CET 2009


Hello all,

I am trying to add a new configuration page and I want to make sure the user is warned if the data format is wrong.  I have gotten to the point where my configuration page in displayed and I can enter values and save them.  The resulting config file is updated in /etc/config so that seems to work.  But for fields that should only take numbers, like a port, I can enter text and click Save & Apply without any errors.  I've tried this with other entry fields such as Network->DHCP.  If I enter a character in the Start textbox and hit Save I see the error: 'Value "10a" of option "dhcp. at dhcp[1].start" does not validate as datatype "uint"'.  This is the kind of thing I want but it's not clear how this checking is done.  I'm using version luci-0.8.7, any insight would be appreciated.  

One more thing, I'm using a listbox to enable/disable other items in a section.  When disabled and the settings saved, the unused options are removed from the configuration file, which is fine.  However, when enabled, the other items reappear but do not contain their assigned default values.  For the listboxes that depended on the enable, they show whatever the first item in there list is, but for my value box it's just empty which is not what I want.  Any idea what would cause this behavior?  I can post my cbi file is necessary.

Thanks,

Andrew
 		 	   		  
_________________________________________________________________
Find the right PC with Windows 7 and Windows Live. 
http://www.microsoft.com/Windows/pc-scout/laptop-set-criteria.aspx?cbid=wl&filt=200,2400,10,19,1,3,1,7,50,650,2,12,0,1000&cat=1,2,3,4,5,6&brands=5,6,7,8,9,10,11,12,13,14,15,16&addf=4,5,9&ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen2:112009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.subsignal.org/pipermail/luci/attachments/20091103/bdfd0cf7/attachment.htm 


More information about the luci mailing list