DragonRAD Forum
June 19, 2013, 02:18:44 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: List Field defaults and Validation  (Read 567 times)
wesoos
Member
***
Posts: 106


View Profile
« on: November 18, 2010, 08:37:06 AM »

Hello, I was wondering how I can get some validation working on list fields.  I have it working with text fields but need it with list fields as well.  With that I probably need some default value as the first item in the list field, something like "--Select Item--".  How can I get a value like that in there if I'm using lookup tables to populate my list fields?

Thanks
Logged
Rob Nicol
Seregon
****
Posts: 82


View Profile
« Reply #1 on: November 18, 2010, 09:38:09 AM »

Here is an example of a data change action script for a list field:

myField = clientevent.field

if (myField.value == "-1") then
  myField.validation = "Field value is invalid"
else
  myField.validation = ""
end

The lookup table bound to this field should include the default value. In your case the first value in the list should have a display value of "-- Select Item --" and a data value of -1. The ordering of the list is defined by the select statement of the associated lookup table.

Rob
Logged
IanBowles
Administrator
*****
Posts: 122


View Profile
« Reply #2 on: November 18, 2010, 10:12:55 AM »

Another way to add a default value is to use the Empty List Selection String = "--Select Now--" This string will be put at the top of the list and will be the initial selection if it's a new record or the assigned data record has no value for that field.
If the list selection is not changed by the user, i.e. left as --Select Now--, this will be treated as a null value.
Logged
IanBowles
Administrator
*****
Posts: 122


View Profile
« Reply #3 on: November 18, 2010, 10:22:49 AM »

You'll also have to set AllowEmpty = true
Logged
wesoos
Member
***
Posts: 106


View Profile
« Reply #4 on: November 18, 2010, 10:49:36 AM »

Thanks guys...
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!