3

I have a list called empribbon and I have created a custom ribbon Tab or Group and I have named it General Info as shown in the image:

My default view for Edit tab

In my custom tab I have also created a button; as shown in the following image

My default view for General info tab

Now what I want is: In the EDIT tab only the field Title must be shown there just like I did it in my photo

How I want EDIT tab to be

and in the General Info tab only those fields Name Age Adress and Phone No must be shown there just like I did it in my photo

How I want General Info tab to be

My code I used to create my General Info tab:

 <?xml version="1.0" encoding="utf-8"?>
 <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
   <CustomAction
     Id="CustomRibbonTab"
     Location="CommandUI.Ribbon"
     RegistrationId="0x0100FF9897B958E2C74FB67BEFF08AFA1786"
     RegistrationType="ContentType">
     <CommandUIExtension>
       <CommandUIDefinitions>
         <CommandUIDefinition
           Location="Ribbon.Tabs._children">
           <Tab
             Id="Ribbon.CustomTab"
             Title="General Info"
             Description="general info"
             Sequence="501">
             <Scaling
               Id="Ribbon.CustomTab.Scaling">
               <MaxSize
                 Id="Ribbon.CustomTab.MaxSize"
                 GroupId="Ribbon.CustomTab.CustomGroup"
                 Size="OneLargeTwoMedium"/>
               <Scale
                 Id="Ribbon.CustomTab.Scaling.CustomTabScaling"
                 GroupId="Ribbon.CustomTab.CustomGroup"
                 Size="OneLargeTwoMedium" />
             </Scaling>
             <Groups Id="Ribbon.CustomTab.Groups">
               <Group
                 Id="Ribbon.CustomTab.CustomGroup"
                 Description="Custom Group!"
                 Title="Custom Group"
                 Sequence="52"
                 Template="Ribbon.Templates.CustomTemplate">
                 <Controls Id="Ribbon.CustomTab.CustomGroup.Controls">
                   <Button
                     Id="Ribbon.CustomTab.CustomGroup.CustomButton"
                     Command="CustomTab.CustomButtonCommand"
                     Sequence="15"
                     Description=""
                     LabelText="Custom Button"
                     Image32by32="/_layouts/images/PPEOPLE.GIF"
                     TemplateAlias="cust1"/>

                 </Controls>
               </Group>
             </Groups>
           </Tab>          
         </CommandUIDefinition>
         <CommandUIDefinition Location="Ribbon.Templates._children">
           <GroupTemplate Id="Ribbon.Templates.CustomTemplate">
             <Layout
               Title="OneLargeTwoMedium"
               LayoutTitle="OneLargeTwoMedium">
               <Section Alignment="Top" Type="OneRow">
                 <Row>
                   <ControlRef DisplayMode="Large" TemplateAlias="cust1" />
                 </Row>
               </Section>
             </Layout>
           </GroupTemplate>
         </CommandUIDefinition>
       </CommandUIDefinitions>
       <CommandUIHandlers>
         <CommandUIHandler
           Command="CustomTab.CustomButtonCommand"
            CommandAction="javascript:alert('Hello, world!');" />
       </CommandUIHandlers>
     </CommandUIExtension>
   </CustomAction>
 </Elements>

How Can I do this?

Please Help me!

0

Quick solution: create your own form in sharepoint designer and set <tr> with "Title" field visible, other <tr> with fields names (Name,Age,etc) set to display:none;. Then write function for your button which will toggle fields (for example, name it function 'toggleFields()') and set it to CommandAction. When you click this button fields will show/hide.

Function example:

function toggleFields(){
    $("[name^='SPBookmark_']").closest("tr").toggle()
}

Where $("[name^='SPBookmark_']") is selector for <a></a> which contains field name. Adapt it for your purposes and improve it how you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.