Gossamer Forum
Home : Products : DBMan : Customization :

...field_from_db + check_box

Quote Reply
...field_from_db + check_box
Okay, I've gone through the forums and the un-officail site too,
I have an input field which uses check_boxes for input to get something like available sizes (in numbers)
ie: 10,11,12,13,14 ...
I would like the user to be able to input their availablity rather than have a selectfield being available or not.

I then used build_select_field_from_db to build the select field, it builds but I got pipes between the numbers
ie: ---
10|11|12
for my selectable options....... ughhhh,

The ~~ are obviously interfering with what I was hoping to accomplish.

Could somebody point me in the right direction?
I do have the feeling that check_boxes are not the way to go or is their someway to tweek the
build_select_field_from_db to do what I need it to do? I don't need mulitple choice selection beyond inputing.

any help would be appreciated.

thanks


Quote Reply
Re: ...field_from_db + check_box In reply to
ok, I've tried this but still no good.....

|;
@size = split(/\|/,$rec{'size'});
$output = qq|<SELECT NAME="$size"><OPTION>---|;
foreach $size (@size) {
foreach $field (sort @selectfields) {
($field eq $value) ?
($output .= "<OPTION SELECTED>$field") :
($output .= "<OPTION>$field");
}
$output .= "</SELECT>";

return $output;
}
print qq|

any clues???

okay --- I've done this but, isn't there a more dynamic way????

<select name=custom1 size=1>|;
if ($rec{'Once'} =~ "S") {
print qq|<option>small|;
}
if ($rec{'Once'} =~ "M") {
print qq|<option>medium|;
}
print qq|</select>

realy would like to reduce this to a build_ ... statement.
Quote Reply
Re: ...field_from_db + check_box In reply to
Taken from the FAQ noted below (under Fields):

Eliminate "|" being displayed for multiple selection listing.

Question:

The chosen options in my multiple selection list are being displayed in html_record_long like this...

Item 1|Item 2|Item 3

Is there anyway I can have it displayed like this...

Item 1, Item 2, Item 3

Answer:

In html_record_long, after: my (%rec) = @_;
Add:

$rec{'FieldName'} =~ s/\|/, /g; ## remove pipe from display

I'm sure you could modify this not either show the comma as in the example above or display a space.

Hope this helps

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: ...field_from_db + check_box In reply to
Lois,
Thanks for your response. I was taking a break from fiddling with DBman for a few days, had bunches of other html work to do.
I'll give it a shot and see what happens, I'll be sure to post the outcomes.

thanks