Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Multi Checkboxes on Modify

Quote Reply
Multi Checkboxes on Modify
Greetings!

I seem to be having a problem with checkboxes, where a field can hold multiple values. There is no problem in adding a new listing - it properly puts in all the values into the database.

The problem is when you try to modify a listing it correctly puts in the values when the form is first loaded, however when the listing is modified the form reloads and then only then leaves only shows up one of the checkboxes selected.

Code:
<input name="Program_Type" type="checkbox" value="Pay Per Sale"<%if Program_Type contains 'Pay Per Sale'%> checked="checked"<%endif%> />
<input name="Program_Type" type="checkbox" value="Pay Per Lead"<%if Program_Type contains 'Pay Per Lead'%> checked="checked"<%endif%> />

If anyone has any ideas of what the problem is here I'd appreciate it.


Regards,


Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] Multi Checkboxes on Modify In reply to
Hi Clint,

Try using "like" instead of "contains"

<input type="checkbox" value="Pay Per Sale" name="Program_Type" <%if Program_Type like 'Pay Per Sale'%>checked<%endif%>>
<input type="checkbox" value="Pay Per Lead" name="Program_Type" <%if Program_Type like 'Pay Per Lead'%>checked<%endif%>>

Hope this helps.

Vishal
-------------------------------------------------------
Quote Reply
Re: [Clint] Multi Checkboxes on Modify In reply to
Hi Clint,

I think the below should work. There is just only "checked" attribute in this type of input


Code:
<input name="Program_Type" type="checkbox" value="Pay Per Sale"<%if Program_Type contains 'Pay Per Sale'%> checked<%endif%> />
<input name="Program_Type" type="checkbox" value="Pay Per Lead"<%if Program_Type contains 'Pay Per Lead'%> checked<%endif%> />



Cheers,

Cheers,

Dat

Programming and creating plugins and templates
Blog