[opencms-dev] How to check the status of a checkbox in a backoffice module?

Andy Fletcher AFletcher at fitchlondon.com
Wed Jun 11 14:18:01 CEST 2003


Maarten,

Wouldn't you need to give a value to the checkbox to make it be detected as "on"?

eg.

<input class="textfeld6" type="checkbox" name="visibility" id="visibility" value="on"]]><PROCESS>visibility</PROCESS><![CDATA[>

String temp = (String) parameters.get("visibility");
if(temp.equals("on"))
	visibility = " checked";
else
	visibility = "";



This way the browser will only return the parameter "visibility" when you check it and it will always be equal to "on" if it is checked.
To make a checkbox be checked you need to provide the checked attribute in the tag. I've added a space before it in the string so that it isn't run onto the value="on"

Bit garbled but hope it helps,
Andy



> -----Original Message-----
> From: Ingen, Maarten van [mailto:maarten.van.ingen at satama.com]
> Sent: 11 June 2003 10:48
> To: 'opencms-dev at opencms.org'
> Subject: [opencms-dev] How to check the status of a checkbox in a
> backoffice module?
> 
> 
> Hi,
> 
> I want to check the status of a checkbox in a backoffice 
> (adding or editting
> an item).
> 
> I git this in my template:
> 
> <td class="formular" height="25">  ]]>
>   <LABEL
> value="com_opencms_modules_showcase_ShowcaseBackoffice.label.v
> isibility"
> /><![CDATA[:
> </td>
> <td class="dialogtxt" >
>   <input class="textfeld6" type="checkbox" name="visibility"
> id="visibility"]]><PROCESS>visibility</PROCESS><![CDATA[>
> </td>
> 
> If I say that the checkbox has to be checked it works fine. 
> But when I'm
> checking the status I can't seem to get it right.
> 
> I use this code to check te status:
> 
> String temp = (String) parameters.get("visibility");
> temp.trim();
> if ( (temp == "on") || (temp == "checked"))
> {
>   visibility = new Boolean(true);
> }
> 
> But visibility is false all the time.
> 
> Can somebody help me with this?
> 
> Thanks in advance.
> 
> Maarten van Ingen
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, 
> please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
> 



More information about the opencms-dev mailing list