select_single, foreign keys, and default options

P

Peter

Guest
Hi,

I am able to populate a drop-down menu with contents of a remote table, however I have hit a snag:

Using a foreign_key_field, the default menu option is always blank. Is there an option to force a default entry? The 'default' field only works for text boxes. This means you cant force a user to make an entry in a field.

If you use the select_options field, you automatically get the first entry as the default in your drop down, and this would be a better idea for the foreign_key_field, as you can always make the first remote-table entry blank if you want to give the user the option of a blank field.

Also, when you do a search, you have the opposite problem. IE you can leave a drop-down empty if you used the foreign_key_ field, but with the select_option you can only do this if you made the first entry in the select_options field blank (and this means the user would have been able to enter a blank field whilst inserting data).

Any comments/work arounds gratefully received.

Maybe some sort of field is required to allow/disable 'blank default on entry / blank default on search'? Or maybe extend the 'default' field to cover drop-downs, but split it into a default for 'inserts', and a default for 'searches'

Thanks for such a great program, its really really useful!!!
P.
 
M

Marg

Guest
I have found that you can force a blank field when using select_single option by placing ~~ at the beginning of the options.

Cheers,
Marg
 
P

Peter

Guest
Thanks Marg, but the problem I have is the opposite to this. I DO want to have a blank field option when doing a record search with the 'select options' field, but NOT have a blank option when adding a record.

I also want to have a blank option whilst searhing a record (when I am using the foreign key field to reference another table for my drop down options), but not to have a blank field whilst adding a record.


At the moment, if you want to have a blank option in 'select options' (to allow searches to have a blank entry in that field), you MUST have a blank entry whilst adding a record. This isnt good if you want to force the user to add a non-blank entry for the field, but want them to be able to search with that field blank. Here, the opposite applies to 'foreign-key' entries. IE you cant stop the default entry being blank when adding a record.

Regards
Peter
 
F

Fernando

Guest
How I can put options in the select single ????

Like a two options = OK or NOK

Tanks
 
A

Andreas

Guest
The file "internal_database.htm" explains all the fieldoptions.
in your case:
*) select_options_field (specify the possible options of a select field e.g. ~~teacher~manager~student~ - in this example the first option is blank-)
*) foreign_key_field (if you want to drive the possible options of a select field from another table, you have to specify here the name of the table/field you want to use separated by a ".", e.g. products_table.desc_product; you can also specify a customized SQL statement, in this case you have to add "SQL:" ad the beginning, e.g. "SQL: select distinct ID_product, desc_product from products_table" produce a select field with several couple "ID_product desc_product" as options
 
P

Peter

Guest
Hi Fernando, Andreas,

Thanks for your responses, however I don't think I am explaining my problem very well.

I know how to use the select_single and foreign_key_fields, but they both have a limitation I am unable to work around.

1) Select_Single (searching):
I wish to allow a blank entry whilst doing a 'search'. Currently this is not possible UNLESS your select_single field had a blank entry option during insert (eg ~~1~2~ etc). However, this means when doing data entry the user will have the option to enter a blank field (something I don't want).
So the issue is that: You cannot force the user to enter data in a field (using select single), if you later wish them to be able to seach that field with a blank entry. I wish to allow blank entry searches for that field, as other fields will contain the data I wish to use in my search criteria.

2) Foreign_key_field (data entry):
I wish to force the user to enter data in the field. However, when using the foreign_key_field to select the allowed entries from another table, the default entry option is always blank. This means you cannot force entry of data into a field.

Is there a way round these issues with dadabik?
My only thoughts are to not use select_single and define all possible entries using the foreign_key_field option pointing to another table (solving issue 1), and then trapping any blank entries using some other code outside of dadabik (solving issue 2).

Thanks in advance for any ideas
Peter
 
E

Eugenio

Guest
Peter wrote:
>
> Hi,
>
> I am able to populate a drop-down menu with contents of a
> remote table, however I have hit a snag:
>
> Using a foreign_key_field, the default menu option is always
> blank. Is there an option to force a default entry? The
> 'default' field only works for text boxes. This means you
> cant force a user to make an entry in a field.
>
> If you use the select_options field, you automatically get
> the first entry as the default in your drop down, and this
> would be a better idea for the foreign_key_field, as you can
> always make the first remote-table entry blank if you want to
> give the user the option of a blank field.
>
> Also, when you do a search, you have the opposite problem. IE
> you can leave a drop-down empty if you used the foreign_key_
> field, but with the select_option you can only do this if you
> made the first entry in the select_options field blank (and
> this means the user would have been able to enter a blank
> field whilst inserting data).
>
> Any comments/work arounds gratefully received.

Hi,
at the moment this feature is not available.

Eugenio.

(Latest version of DaDaBIK when this message was posted: 2.2.1)
 
E

Eugenio

Guest
Eugenio wrote:
>
> Peter wrote:
> >
> > Hi,
> >
> > I am able to populate a drop-down menu with contents of a
> > remote table, however I have hit a snag:
> >
> > Using a foreign_key_field, the default menu option is always
> > blank. Is there an option to force a default entry? The
> > 'default' field only works for text boxes. This means you
> > cant force a user to make an entry in a field.
> >
> > If you use the select_options field, you automatically get
> > the first entry as the default in your drop down, and this
> > would be a better idea for the foreign_key_field, as you can
> > always make the first remote-table entry blank if you want to
> > give the user the option of a blank field.
> >
> > Also, when you do a search, you have the opposite problem. IE
> > you can leave a drop-down empty if you used the foreign_key_
> > field, but with the select_option you can only do this if you
> > made the first entry in the select_options field blank (and
> > this means the user would have been able to enter a blank
> > field whilst inserting data).
> >
> > Any comments/work arounds gratefully received.
>
> Hi,
> at the moment this feature is not available.

Anyway, you can mark the field as "required", in this way the user can't insert a blank field.

Eugenio.

(Latest version of DaDaBIK when this message was posted: 2.2.1)
 
Top