Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Urgent !!!

  Asked By: Ronald    Date: Jun 14    Category: Sharepoint    Views: 886

I just want to know how to refer to a dropdown box which is created
through sharepoint using javascript. As i unserstood the box is
created something like this,

fld = new ChoiceField(frm,"Category0","Category","");
fld.format = "Dropdown";
fld.fFillInChoice = true;
fld.AddChoice("Choice", "");
fld.AddChoice("Choice1", "");

Is there a way that i can use a onChange event like we normally
specify within html <select> tags? and if i want to refer this field,
how do i do that?

im a beginner to sharepoint and need ur help in this pls.



2 Answers Found

Answer #1    Answered By: Ruth George     Answered On: Jun 14

I haven't found a way to manipulate Choice fields using JavaScript. I'd
be very interested in how these fields can be manipulated client-side.
It would provide a means to overcome one of my platform busters.

Answer #2    Answered By: Peter Peterson     Answered On: Jun 14

Here is some JS I inherited from a previous co-worker. Let me know if this
helps. I have several other JS scripts for SP interaction as well.
SharePoint Users Group of NoVA
function GetSharePointDropDownSelectionMade(elementName)
var fld;
var i=0;
var result = "";

for (i=0;i<frmCurrent.ifldMax;i++)
if (frmCurrent.rgfld[i].stName == elementName)
fld = frmCurrent.rgfld[i];

if(fld.format == "Dropdown")

//Get Control
var fieldControl = frmCurrent.FieldSubPart(fld, fld.format);
var fieldSelectedIndex = fieldControl.selectedIndex;

result = fld.rgChoices[fieldSelectedIndex].stValue;
alert("The element Name:" + elementName + " is not a Drop Down

//Move to the end of the array
i = frmCurrent.ifldMax;

}//end if
} //end for loop

return result;

Didn't find what you were looking for? Find more on Urgent !!! Or get search suggestion and latest updates.