logo

New Response

« Return to the blog entry

You are replying to:

    • avatar
    • TonyC
    • Posted on Wed 23 May 2007 08:33 AM

    With the assistance of a colleague, the code has been slightly modified from Jakes original entry, by adding Mathieu's hint about labels and putting a simple bit of HTML code as below. I have put some REM's in to help me -

    field_name:="enteryourfieldname";

    options:= @DBColumn(""; ""; "(hiddenviewname)"; 1);

    REM "or use hardcoding to put your values in";

    REM "the example used below is taken from one of my databases";

    options:= "Call" : "Change" : "Problem" : "Visit";

    REM " change the value for 'Columns' to however many you wish to use";

    columns:=4;

    REM "Nothing in the code below should be changed";

    @If(!@IsDocBeingEdited;

    @Return(@Implode(@GetField(field_name); ", "));

    "");

    count:=@Elements(options);

    html:="<table><tr><td>";

    @For(n:=1; n<=count; n:=n+1;

    REM "The width of the check boxes can be changed by varying the 'width' setting in the line below";

    html:=html + "<label style='padding:0; width:85px'>"+options[n]+"</label> <input type=\"checkbox\" "

    + @If(@Contains(@GetField(field_name); options[n]); "checked "; "")

    + "name=\"" + field_name + "\" value=\"" + options[n] + "\" /> "

    + @If( @Modulo(n; @Round(count/columns) ) = 0; "</td><td>"; "<br>"));

    html + "</td></tr></table>"

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: