Moss 2007 FAQ: Enable/ Disable fields with selection of radio button in Moss 2007 - By Mario Fernandes

Query by Biplab Mitra: 

I need some help from you regarding MOSS.

I need to enable/disable some fields with the selection of radio buttons.

How can I add JavaScript to the fields in the list? As I am unable to get the field ID.

Even I need to add some logic for calculating some fields with the selection of the radio buttons.

Solution by Mario Fernandes

  1. Open the List.  ( I am assuming its Employee list.)

  2. Pick any one record & go in edit mode.

  3. Right click on the page & View Source

  4. Search for <form element  - note down the “name” value

  5. Search for the field you wish to make read only say “EmployeeName”. Check <input element next to it – note down the “name” value

  6. Copy the URL of this EditForm.aspx

  7. Open Sharepoint Designer, File à Open à paste the url you copied

  8. Go to code window.

  9. Locate <IMG src="/_layouts/images/blank.gif"

  10. Just after this <Img> element put this code  ---      document.formname.inputfieldname

  11. <script type="text/javascript" language="javascript">document.aspnetForm.ctl00$m$g_bf411c27_b525_4df6_a7f3_a64ee5b5aef3$ctl00$ctl04$ctl01$ctl00$ctl00$ctl04$ctl00$ctl00$TextField.disabled="true";</script>

  12. Save the form. Refresh the page.

  13. There you go

Synergetics is a premium brand in the Indian IT industry in the area of people competency development  engaged in delivering it thru  its training and consulting interventions; primarily focusing on their productivity with regards to the project and deliverables on hand . Its primary differentiator has been its solution centric approach and its comprehensive client focused service portfolio.

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

.NET 3.5 WPF FAQ: How to remove highlighted attributes in WPF application - By Mario Fernandes

Query by Mr. Rajpreet Singh

I have a query in my WPF application.

I was trying to generate XAML styles at runtime using the following code:

XNamespace xmlns = XNamespace.Get("http://schemas.microsoft.com/winfx/2006/xaml/presentation");

XNamespace x = XNamespace.Get("http://schemas.microsoft.com/winfx/2006/xaml");

XDocument xamlDoc = new XDocument(

      new XElement(xmlns + "ResourceDictionary",

            new XAttribute(XNamespace.Xmlns + "x", x.NamespaceName)));

xamlDoc.Root.Add(

      new XElement("SolidColorBrush",

            new XAttribute(x + "Key", "ButtonBrush"),

            new XAttribute("Color", "Red")));

The output which I get is as shown below, but it also brings this (highlighted) useless attribute.

<ResourceDictionary xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">

            <SolidColorBrush x:Key="AutoBrush" Color="Black" xmlns="" />

      </ResourceDictionary>

Please tell me what I should change in the code to get rid of this. For now I have manually removed it from the XAML string.

I have also tried combing both the statements into a single one but that also doesn’t help:

XDocument xamlDoc = new XDocument(

new XElement(xmlns + "ResourceDictionary",

new XAttribute(XNamespace.Xmlns + "x", x.NamespaceName),

new XElement("SolidColorBrush",

new XAttribute(x + "Key", "ButtonBrush"),

new XAttribute("Color", "Red"))));

Solutions by Mario Fernandes

(Just add the variable I have marked in green.)

XNamespace xmlns = XNamespace.Get("http://schemas.microsoft.com/winfx/2006/xaml/presentation");

XNamespace x = XNamespace.Get("http://schemas.microsoft.com/winfx/2006/xaml");

XDocument xamlDoc = new XDocument(

      new XElement(xmlns + "ResourceDictionary",

            new XAttribute(XNamespace.Xmlns + "x", x.NamespaceName)));

xamlDoc.Root.Add(

      new XElement(xmlns + "SolidColorBrush",

            new XAttribute(x + "Key", "ButtonBrush"),

            new XAttribute("Color", "Red")));

The output which I get is as shown below, but it also brings this (highlighted) useless attribute.

<ResourceDictionary xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">

            <SolidColorBrush x:Key="AutoBrush" Color="Black" xmlns="" />

      </ResourceDictionary>

Please tell me what I should change in the code to get rid of this. For now I have manually removed it from the XAML string.

I have also tried combing both the statements into a single one but that also doesn’t help:

XDocument xamlDoc = new XDocument(

new XElement(xmlns + "ResourceDictionary",

new XAttribute(XNamespace.Xmlns + "x", x.NamespaceName),

new XElement("SolidColorBrush",

new XAttribute(x + "Key", "ButtonBrush"),

new XAttribute("Color", "Red"))));

 Microsoft ASP.NET is a free technology that allows programmers to create dynamic web applications. ASP.NET can be used to create anything from small, personal websites through to large, enterprise-class web applications.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5