Hi All
This I hope is a simple question:
I have a field in a table that I want to be 'required' but appear empty when you first open the form, but not accept blank and be from a dropdown list.
at the moment this field looks like:
<code>
$opts['fdd']['client_on_tax_cd'] = array(
'name' => 'Client on tax CU Form',
'select' => 'D',
'maxlen' => 1,
'values' => array(' ','Y','N'),
'options' => 'ACV',
'required' => true,
'sort' => true
</code>
as the first value is ' ', this field looks empty when the form is opened but when you hit the Save button it doesnt come up with a warning saying that you must enter data into this field as its required as it accepts ' ', as a selection.
Is there a way to changes this so that the field is blank when opened, be from a dropdown list, and not accept blank as a selection?
Hope this makes sense
Cheers
Ned
|
ned@kelly.org.au wrote: |
'values' => array(' ','Y','N'),
Ned |
I haven't tried this so I'm just guessing / speculating but... have you tried getting rid of the space?
i.e.
'values' => array('','Y','N'),
Would that work??
|
Thanks for the reply Michal
the 'js''regexp' worked fine on normal - text entry fields but I can't get it to work on dropdown lists
from the below code I would expect that if there it was empty(the first option) OR if the answer was Y or N then a JavaScript box would appear with the text from 'hint', but its just not happening, it accepts anything.
Code: |
$opts['fdd']['client_on_tax'] = array(
'name' => 'Client on tax *',
'select' => 'D',
'maxlen' => 1,
'values' => array('','Y','N'),
'js' => array(
'required' => true,
'regexp' => '/^[0-9]*$/',
'hint' => 'Please enter a option for Client on Tax'
),
'required' => true,
'options' => 'ACV',
'sort' => true
);
|
Is there anything wrong with the above code?
Note: I updated to the latest myphpedit.class.php file
Cheers
Ned
|