Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Multiple Field Value Modify

Quote Reply
Multiple Field Value Modify
Hi-

I just upgraded to the new version 2.0.5 and was very, very happy that now people can add multiple values to a field using checkboxes and have them show up properly on the validate.

Now, I'm just stuck with the modify process such that the when a user goes to modify their link that the multiple values that are selected are displayed as checked in the check boxes on the modify form.

I tried the following for a field called State which can have multiple values (50 state names):

<input type="checkbox" name="Multiple" value="Arizona" <%if State='Arizona'%>checked<%endif%>>Arizona

<input type="checkbox" name="State" value="Alaska"<%if State='Alaska'%>checked<%endif%>>Alaska

<input type="checkbox" name="State" value="California"<%if State='California'%>checked<%endif%>>California

But this will return all of the boxes checked even if only one or two of them were actually selected.

Does anyone know if there is a way to have a conditional that will determine whether that value is already checked so that it will display as checked on the modify form?

Any help would be greatly appreciated...

-jw

Quote Reply
Re: Multiple Field Value Modify In reply to
Hi,

In your templates, you need to do:

<%if State like 'Arizona'%> checked<%endif%>

as 'State' is a string of all the states selected joined together, so eq or = will fail.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Multiple Field Value Modify In reply to
Fantastic! That worked perfectly...

-jw

Quote Reply
Re: [Alex] Multiple Field Value Modify In reply to
I'm getting a similiar problem with this and cannot for the life of me resolve it. I have a number of checkboxes setup as follows:

<INPUT type="checkbox" name=cbT15_1 <%if cbT15_1 like 'ON'%>checked<%endif%> value="ON">
<INPUT type="checkbox" name=cbT15_1 <%if cbT15_2 like 'ON'%>checked<%endif%> value="ON">
<INPUT type="checkbox" name=cbT15_1 <%if cbT15_3 like 'ON'%>checked<%endif%> value="ON">
<INPUT type="checkbox" name=cbT14_34 <%if cbT14_34 like 'ON'%>checked<%endif%> value="ON">

But once the user submits the form, the detailed template shows every single checkbox as being checked. Can you see what I'm doing incorrectly?
Perl Hopefull
Quote Reply
Re: [stilton] Multiple Field Value Modify In reply to
You have cbT15_1 as the name in the first three checkboxes.
Quote Reply
Re: [afinlr] Multiple Field Value Modify In reply to
Sorry, I copied them here and didn't change the values...

<INPUT type="checkbox" name=cbT15_1 <%if cbT15_1 like 'ON'%>checked<%endif%> value="ON">
<INPUT type="checkbox" name=cbT15_2 <%if cbT15_2 like 'ON'%>checked<%endif%> value="ON">
<INPUT type="checkbox" name=cbT15_31 <%if cbT15_3 like 'ON'%>checked<%endif%> value="ON">
<INPUT type="checkbox" name=cbT14_34 <%if cbT14_34 like 'ON'%>checked<%endif%> value="ON">


This is the way they are listed...
Perl Hopefull
Quote Reply
Re: [stilton] Multiple Field Value Modify In reply to
Can you describe the column cbT15_1 - is it enum - what values can it take - what is its default value?

When you say that they are all shown as checked on the detailed page, what value do they show in the database and what code are you using to show them on the detailed page?
Quote Reply
Re: [afinlr] Multiple Field Value Modify In reply to
The column type is CHAR and is not indexed, size is 5, no default value assigned and not null is set to no. Form type of course is a checkbox and in the form names and form values I have ON as the option.

Thanks for any input...
Perl Hopefull
Quote Reply
Re: [stilton] Multiple Field Value Modify In reply to
Can anyone help me out of this spot? I still haven't been able to figure out what I'm doing wrong.....
Perl Hopefull
Quote Reply
Re: [stilton] Multiple Field Value Modify In reply to
I've come to the conclusion that you cannot use a checkbox in this manner on a multi-page form with hidden values stored till the end. For some reason, the checkbox is always selected unless it's passed as a normal, (not hidden) variable.
Perl Hopefull