Custom Button Control

[quality-blocking code="us, ca, uk, au" display="1"][phpbay]se545kw04709,4,"","","","","","","","","","snaps-landr-SEKW","1","","4",""[/phpbay][/quality-blocking]

Custom Button Control with ...

Radio Button Custom Field Choice - Going from Vertical to Horizontal with Java Script

Author: KWizCom Corporation

Have you noticed that field choice only gives a vertical view?

But what if I want a horizontal view?

When you want to customize your view but don't know how it can be very frustrating but there is always a way, you just have to know howa€¦

 

For example:

I want to use the field "Gender" with two choice options - male and female.

In MOSS this field would be vertical display, with the radio buttons and the choices on top of each other:

0  Male

0 Female

 

But I don't want to waste so much screen space. It would be much better to have a horizontal display, with the choices and their radio buttons next to each other like so:

0 Male  0 Female

 

With a little Javascript it's not so hard to go from vertical to horizontal. Here's how you do it:

Simply add this code to the form (add it in the SPD to NewForm.aspx and EditForm.aspx for the list that includes the view you want to change):

 

    var inputs = document.getElementsByTagName("INPUT");

    var radios = new Array();

    for (var i = 0; i < inputs.length; i++)

    {

        if (inputs[i].type == "radio")

            radios.push(inputs[i]);

    }

    var html = new String();

    var openTable = "

";

    var closeTable = "

";

    for (var i = 0; i < radios.length-1; i++)

    {

        if (i == 0)

            html = openTable;

        var obj = radios[i];

        while (true)

        {

            if (obj.tagName == "TD")

                break;

            else

                obj = obj.parentElement;

        }         

        html = html + "" + obj[removed] + "";

        if (radios[i].name != radios[i+1].name)

        {

            html = html + closeTable;

            var obj2 = obj;

            while (true)

            {

               if (obj2.tagName == "SPAN")

                   break;

               else

                   obj2 = obj2.parentElement;

            }      

            obj2[removed] = html;

             html = openTable;

        }

        if (i == radios.length-2)

        {

            html = html + "" + obj[removed] + "";

            html = html + closeTable;

            var obj2 = obj;

            while (true)

            {

               if (obj2.tagName == "SPAN")

                   break;

               else

                   obj2 = obj2.parentElement;

            }      

            obj2[removed] = html;

        }

    }

 

 

 

That all - now we have our Male/Female options in the desired view layout!

 

Article Source: http://www.articlesbase.com/software-articles/radio-button-custom-field-choice-going-from-vertical-to-horizontal-with-java-script-989608.html

About the Author

The KWizCom team utilizes their experience and knowledge to give fresh insight on Microsoft's SharePoint and CRM Products and Technologies...
KWizCom's Roi Kolbringer, SharePoint and .Net expert is a SharePoint Technical Consultant and Developer for KWizCom and a contributor on the KWizCom blog.



Fatal error: Call to undefined function phpBayPro() in /home/landrwor/public_html/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code on line 91