Re: clear value of a drop down field

This is a discussion on Re: clear value of a drop down field within the Javascript forums in Programming Languages category; drop downs are implemeted in the browser as a <select>. the select object has a collection options. in turn, these options have a selected property. to clear the selection in a <select> options list just: for (i=0; i < document.crmForm.DropDownFieldName.options.length; ++ i) document.crmForm.DropDownFieldName.options[i].selected = false; or you can use the selectedIndex property of the select: document.crmForm.DropDownFieldName.selectedIndex = -1; -- bruce (sqlwork.com) "Simone Bullinger" <Simone.Bullinger @ cellent.de> wrote in message news:OnySpOR$DHA.2476 @ TK2MSFTNGP12.phx.gbl... Hi, i have a problem to claer the value of a drop down field in a MS CRM formular. The CRM Newsgroups couldn't help me to solve this ...

Go Back   Application Development Forum > Programming Languages > Javascript

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 02-27-2004, 12:26 PM
bruce barker
Guest
 
Default Re: clear value of a drop down field

drop downs are implemeted in the browser as a <select>. the select object has a collection options. in turn, these options have a selected property. to clear the selection in a <select> options list just:

for (i=0; i < document.crmForm.DropDownFieldName.options.length; ++ i)
document.crmForm.DropDownFieldName.options[i].selected = false;

or you can use the selectedIndex property of the select:

document.crmForm.DropDownFieldName.selectedIndex = -1;

-- bruce (sqlwork.com)



"Simone Bullinger" <Simone.Bullinger@cellent.de> wrote in message news:OnySpOR$DHA.2476@TK2MSFTNGP12.phx.gbl...
Hi,

i have a problem to claer the value of a drop down field in a MS CRM formular. The CRM Newsgroups couldn't help me to solve this problem. I hope anybody here can...

I added a drop down box and filled it with the values A, B and C. The returnValues are 1, 2 and 3. On default the field is empty (screenshot is attached!).

To set the value of a Drop Down Field with an JScript I have to write:

crmForm.DropDownFieldName.value = "A";
crmForm.DropDownFieldName.returnValue = "1"; // the according returnValue to the Value "A"
crmForm.DropDownFieldName.click(); //without this, the value will not be saved

But how can I delete the selection of the Drop Down Field to have an empty Field?

The vlaue list of the field don't contain a blank value and I can't insert a blank value. If i try it tells me to give in a name for the
vlaue... So I have to set the default value, which is blank...

I tried .value = "" and .returnValue = 0 or .returnValue = "" to clear the Field, but nothing worked (or it worked, but the value will not be saved with the dataset).

I tried also to set .value and .returnValue = null or = empty. In both cases it occures an error on the web page ("...object is undefined...").

I added an alert ("Value: " + Fieldname.value + "returnValue: " + Fieldname.returnValue) to see what values a empty default field contains. The only thing the messagebox show is:
Vlaue: returnValue:


Any idea??

Simone
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 09:45 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.