DragonRAD Forum
May 26, 2013, 02:41:37 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Required fields - lists and others  (Read 458 times)
DerekPapworth
Member
*
Posts: 46


View Profile
« on: November 29, 2010, 04:40:35 AM »

Hi there,

Trying to get a list field to be required whereby it's blank by default if it's a new record or if the db record is NULL but the user must choose a value from the list. I assume this must be possible by using a combination of the "Allow empty" setting along with the "Empty List Selection string" however no matter which combination I try it allows me to save a record with blank (not selected) entry. What's exactly the right way to do this? Note I don't want the the first entry selected by default, the user must be forced to choose a value so they can't just open a record and save it, they must goto the field to choose a valid selection.

Also there doesn't seem to be anywhere to declare other sorts of fields (integer, text, etc) to be required (not empty) - is that right?

Thanks,

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


View Profile
« Reply #1 on: November 29, 2010, 06:59:42 AM »

I think you'll want to use Field Validation to ensure that a value is entered prior to saving.
A combination of "Empty List Selection String" and "Allow Empty" can be used to set the initial value to blank on new records (or records that have a null value in the db).

Have a look here to see if this would help:
http://dragonrad.com/twiki/bin/view/Help/FieldValidation

Also discussed here:
http://dragonrad.com/smf/index.php?topic=34.0

I'll update our documentation a little for the "Empty List Selection String" and "Allow Empty". It should be covered here:
http://dragonrad.com/twiki/bin/view/Help/OtherFields#List_field
Logged
DerekPapworth
Member
*
Posts: 46


View Profile
« Reply #2 on: November 29, 2010, 07:59:40 AM »

Hi Rob,

Ok looks like Field Validation would be the answer then which I'll explore.

Guess I was hoping that Required vs Optional would be a standard flag say against a field rather than having to create a script as that's one validation that's used so frequently so might be worth thinking about for future?

Thanks,

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


View Profile
« Reply #3 on: November 29, 2010, 09:04:40 AM »

Thanks for the feedback Derek!

We'll look into a flag to make it easier to define mandatory/optional fields. Perhaps by checking null/empty string as a basic check if the field is tagged mandatory.

Rob
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!