Gossamer Forum
Home : Products : DBMan : Customization :

$db_auto_generate turned off and %db_radio_fields

Quote Reply
$db_auto_generate turned off and %db_radio_fields
JPDeni,

If I have $db_auto_generate turned off, do I still need to define %db_checkbox_fields and %db_radio_fields in the cfg file, or can I simply set up the form html.pl with the checkbox and radio values?

Obviously I'll still set them up in %db_def.



------------------
Safe swoops
Sangiro

http://www.dropzone.com/
Quote Reply
Re: $db_auto_generate turned off and %db_radio_fields In reply to
Yes, you do still need to set up the radio and checkbox fields -- if you want the values to be retained when a record is modified. The only way DBMan "knows" which of the radio buttons to select, or whether to check the checkbox during a modify is to use the

print &build_radio_field("FieldName","$rec{'FieldName'});
or
print &build_checkbox_field("FieldName","$rec{'FieldName'});

structures.

If you don't mind resetting the values every time a record is modified, you can use your own radio and checkbox fields.



------------------
JPD





Quote Reply
Re: $db_auto_generate turned off and %db_radio_fields In reply to
Thanks JPD,

I guess this also explains why I have to reselect the my country (%db_select_fields) every time I do a modify! Bonus tip for me.

Sleep well.


------------------
Safe swoops
Sangiro

http://www.dropzone.com/
Quote Reply
Re: $db_auto_generate turned off and %db_radio_fields In reply to
JPD,

The nfolowing two code snippets from my html.pl file:

Code:
<TD VALIGN="TOP" BGCOLOR="#EEEEFF"><$font>|; print &build_radio_field ("Tandem", "$rec{'Tandem'}"); print qq|</font></TD></TR><BR>

<TD VALIGN="TOP" BGCOLOR="#EEEEFF"><$font>|; print &build_select_field ("Region", "$rec{'Region'}"); print qq|</font></TD></TR>

On modifyng the records the first one, which builds a radio button, comes up with the value of the selection displayed.

The secon part however, a dropdown select box, shows up empty and I have to reselect what was in there. I suspect this has something to do with the iscussion above.

Can you see what's causing this? I looked but they look milar to me.


------------------
Safe swoops
Sangiro

http://www.dropzone.com/
Quote Reply
Re: $db_auto_generate turned off and %db_radio_fields In reply to
I've found two possible reasons for problems with select fields not displaying the data.

The first is that your field name is incorrect -- misspelling or different capitalization.

The other one is your definintion of the select field in the .cfg file. All of your options must be on one line and you should have no spaces before or after the commas separating the options.

Code:
Right:
FieldName => 'Option1,Option2,Option3'

Wrong:
FieldName => 'Option1, Option2,
Option3'

Check those two things first. If you're still having trouble, we'll see what we can figure out.


------------------
JPD





Quote Reply
Re: $db_auto_generate turned off and %db_radio_fields In reply to
I have a way around all of this.

Code:
<select NAME="br" VALUE="$rec{'br'}" size="1"><option value="1"|;if ($rec{'br'} eq '1') {print qq| SELECTED|;}print qq|>1</option><option value="2"|;if ($rec{'br'} eq '2') {print qq| SELECTED|;}print qq|>2</option><option value="3"|;if ($rec{'br'} eq '3') {print qq| SELECTED|;}print qq|>3</option><option value="4"|;if ($rec{'br'} eq '4') {print qq| SELECTED|;}print qq|>4</option><option value="5"|;if ($rec{'br'} eq '5') {print qq| SELECTED|;}print qq|>5</option><option value="6"|;if ($rec{'br'} eq '6') {print qq| SELECTED|;}print qq|>6</option><option value="7"|;if ($rec{'br'} eq '7') {print qq| SELECTED|;}print qq|>7</option><option value="8"|;if ($rec{'br'} eq '8') {print qq| SELECTED|;}print qq|>8</option></select>
This works fine for me and lets you use your own forms. You can do the same for checkboxes and radios and such using "checked" or the appropriate attribute.

Chris



------------------
webmaster@racedaze.com