Lead Tab - Web Info Tab Field Jscript drop down box conversion

I am converting the Potential Account Size field to in Lead Tab - Web Info 
Tab to a combo box using jscript in the OnLoad event. This code worked just 
fine in the Salutation field in Lead Tab-General Tab but refuses to work in 
this field and I am relatively new to jscript. Can someone give me a clue to 
what is wrong? Here is the code:

//DROP DOWN BOX FOR POTENTIAL ACCOUNT SIZE
//The potential account size lookup field to change. 
var fieldN = "new_potentialaccountsize";

//I'm saving the current potential account size value to set it as the 
default in the created combobox. 
var defaultV = crmForm.all.item(fieldName).DataValue;

//This is the TD element containing the text box control. We will replace 
the entire innerHTML to replace
//the input type="text" element with a select element. 
var tble = crmForm.all.item(fieldN + "_d"); 

//This is the beginning of our new combobox. It's a standard HTML 
declaration and all we need to do is to
//fill the appropriate options. You should check the original HTML code to 
get the appropriate values for
//req (field required level) and the tab index. 
var selection = "<selection req='0' id='" + fieldN + "' name='" + fieldN + 
"' defaultSelected='' class='selectBox' tabindex='1380'>";

//The defaultValFd serves as an indicator if the current field value 
(defaultV) corresponds to one
//of the options we have inserted into the combobox. If the current value 
was not found, we will insert it as
//a separate option, ensuring that the stored value always is displayed. 
var defaultValFd = false;

//This is the potential account size list. Empty string is added as the 
first array element, allowing a user to remove a selection.
var Optns = new Array(
   "", 
   "Ms.",
   "Mr.",
   "Mrs.",
   "Doctor",
   "Miss"
 );

//Now let's add all of the potential account size names as option elements. 
for (index in Optns) {

   //Create a new option element and set the value to the current potential 
account size of the loop. The value provided in
   //the value attribute will be stored in the database, so you have the 
option to use ISO codes or numbers
   //if you want. As I always want to have the full potential account size 
name stored in the database, I use the full
   //potential account size name. 
   selection += "<Optns value='" + Optns[index] + "'";

   //If this is the default value (the current value stored in the entity), 
I do two things: first, I add the
   //SELECTED attribute to the current option, forcing the combobox to 
select it by default. Second, I set
   //defaultValFd to true, indicating that I don't need to add the default 
value to the list after 
   //exiting this loop.
   if (Optns[index] == defaultV) {
      selection += " SELECTED";
      defaultValFd = true;
   }

   //Add the remaining parts of the Optns element. The value specified 
between <Optns> and </Optns> is
   //the text displayed in the combobox. In this sample it's identical to 
the text provided in the value
   //attribute. 
   selection += ">" + Optns[index] + "</Optns>";
}

//Here's the part that ensures that an existing entity will always display 
the stored value of the 
//potential account size field, no matter if it is included in the option 
list or not. If it is set and it was not found
//in the previous loop, then defaultValFd will still be false and we have to 
add it as a separate 
//option, which is also SELECTED.
if ((defaultV != null) && (defaultV.length > 0) && !defaultValFd) {
   selection += "<Optns value='" + defaultV + "' SELECTED>" + defaultV + 
"</Optns>";
}

//Close the open select element. 
selection += "</selection>";

//Finally, I replace the entire definition of the text box with the newly 
constructed combobox. IE is very
//smart and will instantly update the window. You now have a combobox with a 
list of all 
//potential account size and it will be saved directly to the potential 
account size field. 
tble.innerHTML = selection;



Thanks for all help in advance.


-- 
Dave Christman
System Developer
0
9/21/2007 5:44:03 PM
crm 35858 articles. 1 followers. Follow

4 Replies
1142 Views

Similar Articles

[PageSpeed] 30

Hi,

Could it be you made a type on the second line:
var defaultV = crmForm.all.item(fieldN).DataValue;
(fieldName should be fieldN)

I remember the original script was posted by Michael Höhne somewhere, please 
take a look at the original script, and rebuild your code and you will be 
fine!

Best regards,

Merijn van Mourik

"Dave Christman" wrote:

> I am converting the Potential Account Size field to in Lead Tab - Web Info 
> Tab to a combo box using jscript in the OnLoad event. This code worked just 
> fine in the Salutation field in Lead Tab-General Tab but refuses to work in 
> this field and I am relatively new to jscript. Can someone give me a clue to 
> what is wrong? Here is the code:
> 
> //DROP DOWN BOX FOR POTENTIAL ACCOUNT SIZE
> //The potential account size lookup field to change. 
> var fieldN = "new_potentialaccountsize";
> 
> //I'm saving the current potential account size value to set it as the 
> default in the created combobox. 
> var defaultV = crmForm.all.item(fieldName).DataValue;
> 
> //This is the TD element containing the text box control. We will replace 
> the entire innerHTML to replace
> //the input type="text" element with a select element. 
> var tble = crmForm.all.item(fieldN + "_d"); 
> 
> //This is the beginning of our new combobox. It's a standard HTML 
> declaration and all we need to do is to
> //fill the appropriate options. You should check the original HTML code to 
> get the appropriate values for
> //req (field required level) and the tab index. 
> var selection = "<selection req='0' id='" + fieldN + "' name='" + fieldN + 
> "' defaultSelected='' class='selectBox' tabindex='1380'>";
> 
> //The defaultValFd serves as an indicator if the current field value 
> (defaultV) corresponds to one
> //of the options we have inserted into the combobox. If the current value 
> was not found, we will insert it as
> //a separate option, ensuring that the stored value always is displayed. 
> var defaultValFd = false;
> 
> //This is the potential account size list. Empty string is added as the 
> first array element, allowing a user to remove a selection.
> var Optns = new Array(
>    "", 
>    "Ms.",
>    "Mr.",
>    "Mrs.",
>    "Doctor",
>    "Miss"
>  );
> 
> //Now let's add all of the potential account size names as option elements. 
> for (index in Optns) {
> 
>    //Create a new option element and set the value to the current potential 
> account size of the loop. The value provided in
>    //the value attribute will be stored in the database, so you have the 
> option to use ISO codes or numbers
>    //if you want. As I always want to have the full potential account size 
> name stored in the database, I use the full
>    //potential account size name. 
>    selection += "<Optns value='" + Optns[index] + "'";
> 
>    //If this is the default value (the current value stored in the entity), 
> I do two things: first, I add the
>    //SELECTED attribute to the current option, forcing the combobox to 
> select it by default. Second, I set
>    //defaultValFd to true, indicating that I don't need to add the default 
> value to the list after 
>    //exiting this loop.
>    if (Optns[index] == defaultV) {
>       selection += " SELECTED";
>       defaultValFd = true;
>    }
> 
>    //Add the remaining parts of the Optns element. The value specified 
> between <Optns> and </Optns> is
>    //the text displayed in the combobox. In this sample it's identical to 
> the text provided in the value
>    //attribute. 
>    selection += ">" + Optns[index] + "</Optns>";
> }
> 
> //Here's the part that ensures that an existing entity will always display 
> the stored value of the 
> //potential account size field, no matter if it is included in the option 
> list or not. If it is set and it was not found
> //in the previous loop, then defaultValFd will still be false and we have to 
> add it as a separate 
> //option, which is also SELECTED.
> if ((defaultV != null) && (defaultV.length > 0) && !defaultValFd) {
>    selection += "<Optns value='" + defaultV + "' SELECTED>" + defaultV + 
> "</Optns>";
> }
> 
> //Close the open select element. 
> selection += "</selection>";
> 
> //Finally, I replace the entire definition of the text box with the newly 
> constructed combobox. IE is very
> //smart and will instantly update the window. You now have a combobox with a 
> list of all 
> //potential account size and it will be saved directly to the potential 
> account size field. 
> tble.innerHTML = selection;
> 
> 
> 
> Thanks for all help in advance.
> 
> 
> -- 
> Dave Christman
> System Developer
0
Utf
9/24/2007 3:56:05 PM
Thanks for you suggestion. I had already found that problem and corrected it. 
This code results in the following output:

Potential Account Size Ms.Mr.Mrs.DoctorMiss
-- 
Dave Christman
System Developer


"Merijn van Mourik" wrote:

> Hi,
> 
> Could it be you made a type on the second line:
> var defaultV = crmForm.all.item(fieldN).DataValue;
> (fieldName should be fieldN)
> 
> I remember the original script was posted by Michael Höhne somewhere, please 
> take a look at the original script, and rebuild your code and you will be 
> fine!
> 
> Best regards,
> 
> Merijn van Mourik
> 
> "Dave Christman" wrote:
> 
> > I am converting the Potential Account Size field to in Lead Tab - Web Info 
> > Tab to a combo box using jscript in the OnLoad event. This code worked just 
> > fine in the Salutation field in Lead Tab-General Tab but refuses to work in 
> > this field and I am relatively new to jscript. Can someone give me a clue to 
> > what is wrong? Here is the code:
> > 
> > //DROP DOWN BOX FOR POTENTIAL ACCOUNT SIZE
> > //The potential account size lookup field to change. 
> > var fieldN = "new_potentialaccountsize";
> > 
> > //I'm saving the current potential account size value to set it as the 
> > default in the created combobox. 
> > var defaultV = crmForm.all.item(fieldName).DataValue;
> > 
> > //This is the TD element containing the text box control. We will replace 
> > the entire innerHTML to replace
> > //the input type="text" element with a select element. 
> > var tble = crmForm.all.item(fieldN + "_d"); 
> > 
> > //This is the beginning of our new combobox. It's a standard HTML 
> > declaration and all we need to do is to
> > //fill the appropriate options. You should check the original HTML code to 
> > get the appropriate values for
> > //req (field required level) and the tab index. 
> > var selection = "<selection req='0' id='" + fieldN + "' name='" + fieldN + 
> > "' defaultSelected='' class='selectBox' tabindex='1380'>";
> > 
> > //The defaultValFd serves as an indicator if the current field value 
> > (defaultV) corresponds to one
> > //of the options we have inserted into the combobox. If the current value 
> > was not found, we will insert it as
> > //a separate option, ensuring that the stored value always is displayed. 
> > var defaultValFd = false;
> > 
> > //This is the potential account size list. Empty string is added as the 
> > first array element, allowing a user to remove a selection.
> > var Optns = new Array(
> >    "", 
> >    "Ms.",
> >    "Mr.",
> >    "Mrs.",
> >    "Doctor",
> >    "Miss"
> >  );
> > 
> > //Now let's add all of the potential account size names as option elements. 
> > for (index in Optns) {
> > 
> >    //Create a new option element and set the value to the current potential 
> > account size of the loop. The value provided in
> >    //the value attribute will be stored in the database, so you have the 
> > option to use ISO codes or numbers
> >    //if you want. As I always want to have the full potential account size 
> > name stored in the database, I use the full
> >    //potential account size name. 
> >    selection += "<Optns value='" + Optns[index] + "'";
> > 
> >    //If this is the default value (the current value stored in the entity), 
> > I do two things: first, I add the
> >    //SELECTED attribute to the current option, forcing the combobox to 
> > select it by default. Second, I set
> >    //defaultValFd to true, indicating that I don't need to add the default 
> > value to the list after 
> >    //exiting this loop.
> >    if (Optns[index] == defaultV) {
> >       selection += " SELECTED";
> >       defaultValFd = true;
> >    }
> > 
> >    //Add the remaining parts of the Optns element. The value specified 
> > between <Optns> and </Optns> is
> >    //the text displayed in the combobox. In this sample it's identical to 
> > the text provided in the value
> >    //attribute. 
> >    selection += ">" + Optns[index] + "</Optns>";
> > }
> > 
> > //Here's the part that ensures that an existing entity will always display 
> > the stored value of the 
> > //potential account size field, no matter if it is included in the option 
> > list or not. If it is set and it was not found
> > //in the previous loop, then defaultValFd will still be false and we have to 
> > add it as a separate 
> > //option, which is also SELECTED.
> > if ((defaultV != null) && (defaultV.length > 0) && !defaultValFd) {
> >    selection += "<Optns value='" + defaultV + "' SELECTED>" + defaultV + 
> > "</Optns>";
> > }
> > 
> > //Close the open select element. 
> > selection += "</selection>";
> > 
> > //Finally, I replace the entire definition of the text box with the newly 
> > constructed combobox. IE is very
> > //smart and will instantly update the window. You now have a combobox with a 
> > list of all 
> > //potential account size and it will be saved directly to the potential 
> > account size field. 
> > tble.innerHTML = selection;
> > 
> > 
> > 
> > Thanks for all help in advance.
> > 
> > 
> > -- 
> > Dave Christman
> > System Developer
0
Utf
9/24/2007 4:32:01 PM
Hi,

So I did a littlebit reengineering of your code. Found the following typo's
  - fieldName should be fieldN
  - <selection shoud be <select
  - <Optns should be <option

With these modification your code should be ok. With a littlebit of 
struggling you are not far from reaching scripting excellence. 

I do have an extra suggestions. When running (any) custom scripts, always 
check for the form type. And preferably look for the field existence. This 
will significantly reduce the errors shown to the users. And have a look at 
the Client Programmer Guide which can be found in the Microsoft CRM 3.0 SDK.

Best regards,

Merijn van Mourik
http://crmerijn.blogspot.com

if (crmForm.FormType == 1 ||crmForm.FormType==2)
{
var fieldN = "new_potentialaccountsize";
var defaultV = crmForm.all.item(fieldN).DataValue;
var tble = crmForm.all.item(fieldN + "_d"); 
var selection = "<select req='0' id='" + fieldN + "' name='" + fieldN + "' 
defaultSelected='' class='selectBox' tabindex='1380'>";
var defaultValFd = false;
var Optns = new Array( "",  "Ms.", "Mr.", "Mrs.", "Doctor", "Miss");

for (index in Optns) {
   selection += "<option value='" + Optns[index] + "'";
   if (Optns[index] == defaultV) {
      selection += " SELECTED";
      defaultValFd = true;
   }
   selection += ">" + Optns[index] + "</Optns>";
}
if ((defaultV != null) && (defaultV.length > 0) && !defaultValFd) 
{
   selection += "<option value='" + defaultV + "' SELECTED>" + defaultV + 
"</Optns>";
}
selection += "</selection>";
tble.innerHTML = selection;
}

"Dave Christman" wrote:

> Thanks for you suggestion. I had already found that problem and corrected it. 
> This code results in the following output:
> 
> Potential Account Size Ms.Mr.Mrs.DoctorMiss
> -- 
> Dave Christman
> System Developer
> 
> 
> "Merijn van Mourik" wrote:
> 
> > Hi,
> > 
> > Could it be you made a type on the second line:
> > var defaultV = crmForm.all.item(fieldN).DataValue;
> > (fieldName should be fieldN)
> > 
> > I remember the original script was posted by Michael Höhne somewhere, please 
> > take a look at the original script, and rebuild your code and you will be 
> > fine!
> > 
> > Best regards,
> > 
> > Merijn van Mourik
> > 
> > "Dave Christman" wrote:
> > 
> > > I am converting the Potential Account Size field to in Lead Tab - Web Info 
> > > Tab to a combo box using jscript in the OnLoad event. This code worked just 
> > > fine in the Salutation field in Lead Tab-General Tab but refuses to work in 
> > > this field and I am relatively new to jscript. Can someone give me a clue to 
> > > what is wrong? Here is the code:
> > > 
> > > //DROP DOWN BOX FOR POTENTIAL ACCOUNT SIZE
> > > //The potential account size lookup field to change. 
> > > var fieldN = "new_potentialaccountsize";
> > > 
> > > //I'm saving the current potential account size value to set it as the 
> > > default in the created combobox. 
> > > var defaultV = crmForm.all.item(fieldName).DataValue;
> > > 
> > > //This is the TD element containing the text box control. We will replace 
> > > the entire innerHTML to replace
> > > //the input type="text" element with a select element. 
> > > var tble = crmForm.all.item(fieldN + "_d"); 
> > > 
> > > //This is the beginning of our new combobox. It's a standard HTML 
> > > declaration and all we need to do is to
> > > //fill the appropriate options. You should check the original HTML code to 
> > > get the appropriate values for
> > > //req (field required level) and the tab index. 
> > > var selection = "<selection req='0' id='" + fieldN + "' name='" + fieldN + 
> > > "' defaultSelected='' class='selectBox' tabindex='1380'>";
> > > 
> > > //The defaultValFd serves as an indicator if the current field value 
> > > (defaultV) corresponds to one
> > > //of the options we have inserted into the combobox. If the current value 
> > > was not found, we will insert it as
> > > //a separate option, ensuring that the stored value always is displayed. 
> > > var defaultValFd = false;
> > > 
> > > //This is the potential account size list. Empty string is added as the 
> > > first array element, allowing a user to remove a selection.
> > > var Optns = new Array(
> > >    "", 
> > >    "Ms.",
> > >    "Mr.",
> > >    "Mrs.",
> > >    "Doctor",
> > >    "Miss"
> > >  );
> > > 
> > > //Now let's add all of the potential account size names as option elements. 
> > > for (index in Optns) {
> > > 
> > >    //Create a new option element and set the value to the current potential 
> > > account size of the loop. The value provided in
> > >    //the value attribute will be stored in the database, so you have the 
> > > option to use ISO codes or numbers
> > >    //if you want. As I always want to have the full potential account size 
> > > name stored in the database, I use the full
> > >    //potential account size name. 
> > >    selection += "<Optns value='" + Optns[index] + "'";
> > > 
> > >    //If this is the default value (the current value stored in the entity), 
> > > I do two things: first, I add the
> > >    //SELECTED attribute to the current option, forcing the combobox to 
> > > select it by default. Second, I set
> > >    //defaultValFd to true, indicating that I don't need to add the default 
> > > value to the list after 
> > >    //exiting this loop.
> > >    if (Optns[index] == defaultV) {
> > >       selection += " SELECTED";
> > >       defaultValFd = true;
> > >    }
> > > 
> > >    //Add the remaining parts of the Optns element. The value specified 
> > > between <Optns> and </Optns> is
> > >    //the text displayed in the combobox. In this sample it's identical to 
> > > the text provided in the value
> > >    //attribute. 
> > >    selection += ">" + Optns[index] + "</Optns>";
> > > }
> > > 
> > > //Here's the part that ensures that an existing entity will always display 
> > > the stored value of the 
> > > //potential account size field, no matter if it is included in the option 
> > > list or not. If it is set and it was not found
> > > //in the previous loop, then defaultValFd will still be false and we have to 
> > > add it as a separate 
> > > //option, which is also SELECTED.
> > > if ((defaultV != null) && (defaultV.length > 0) && !defaultValFd) {
> > >    selection += "<Optns value='" + defaultV + "' SELECTED>" + defaultV + 
> > > "</Optns>";
> > > }
> > > 
> > > //Close the open select element. 
> > > selection += "</selection>";
> > > 
> > > //Finally, I replace the entire definition of the text box with the newly 
> > > constructed combobox. IE is very
> > > //smart and will instantly update the window. You now have a combobox with a 
> > > list of all 
> > > //potential account size and it will be saved directly to the potential 
> > > account size field. 
> > > tble.innerHTML = selection;
> > > 
> > > 
> > > 
> > > Thanks for all help in advance.
> > > 
> > > 
> > > -- 
> > > Dave Christman
> > > System Developer
0
Utf
9/25/2007 11:46:03 AM
Forgot to mention one thing: the value in tabindex (1380). You should correct 
this value with the original value from the original textfield. Just use your 
internet explorer and look at the source HTML that is shown to you (with the 
script deactivated)

"Merijn van Mourik" wrote:

> Hi,
> 
> So I did a littlebit reengineering of your code. Found the following typo's
>   - fieldName should be fieldN
>   - <selection shoud be <select
>   - <Optns should be <option
> 
> With these modification your code should be ok. With a littlebit of 
> struggling you are not far from reaching scripting excellence. 
> 
> I do have an extra suggestions. When running (any) custom scripts, always 
> check for the form type. And preferably look for the field existence. This 
> will significantly reduce the errors shown to the users. And have a look at 
> the Client Programmer Guide which can be found in the Microsoft CRM 3.0 SDK.
> 
> Best regards,
> 
> Merijn van Mourik
> http://crmerijn.blogspot.com
> 
> if (crmForm.FormType == 1 ||crmForm.FormType==2)
> {
> var fieldN = "new_potentialaccountsize";
> var defaultV = crmForm.all.item(fieldN).DataValue;
> var tble = crmForm.all.item(fieldN + "_d"); 
> var selection = "<select req='0' id='" + fieldN + "' name='" + fieldN + "' 
> defaultSelected='' class='selectBox' tabindex='1380'>";
> var defaultValFd = false;
> var Optns = new Array( "",  "Ms.", "Mr.", "Mrs.", "Doctor", "Miss");
> 
> for (index in Optns) {
>    selection += "<option value='" + Optns[index] + "'";
>    if (Optns[index] == defaultV) {
>       selection += " SELECTED";
>       defaultValFd = true;
>    }
>    selection += ">" + Optns[index] + "</Optns>";
> }
> if ((defaultV != null) && (defaultV.length > 0) && !defaultValFd) 
> {
>    selection += "<option value='" + defaultV + "' SELECTED>" + defaultV + 
> "</Optns>";
> }
> selection += "</selection>";
> tble.innerHTML = selection;
> }
> 
> "Dave Christman" wrote:
> 
> > Thanks for you suggestion. I had already found that problem and corrected it. 
> > This code results in the following output:
> > 
> > Potential Account Size Ms.Mr.Mrs.DoctorMiss
> > -- 
> > Dave Christman
> > System Developer
> > 
> > 
> > "Merijn van Mourik" wrote:
> > 
> > > Hi,
> > > 
> > > Could it be you made a type on the second line:
> > > var defaultV = crmForm.all.item(fieldN).DataValue;
> > > (fieldName should be fieldN)
> > > 
> > > I remember the original script was posted by Michael Höhne somewhere, please 
> > > take a look at the original script, and rebuild your code and you will be 
> > > fine!
> > > 
> > > Best regards,
> > > 
> > > Merijn van Mourik
> > > 
> > > "Dave Christman" wrote:
> > > 
> > > > I am converting the Potential Account Size field to in Lead Tab - Web Info 
> > > > Tab to a combo box using jscript in the OnLoad event. This code worked just 
> > > > fine in the Salutation field in Lead Tab-General Tab but refuses to work in 
> > > > this field and I am relatively new to jscript. Can someone give me a clue to 
> > > > what is wrong? Here is the code:
> > > > 
> > > > //DROP DOWN BOX FOR POTENTIAL ACCOUNT SIZE
> > > > //The potential account size lookup field to change. 
> > > > var fieldN = "new_potentialaccountsize";
> > > > 
> > > > //I'm saving the current potential account size value to set it as the 
> > > > default in the created combobox. 
> > > > var defaultV = crmForm.all.item(fieldName).DataValue;
> > > > 
> > > > //This is the TD element containing the text box control. We will replace 
> > > > the entire innerHTML to replace
> > > > //the input type="text" element with a select element. 
> > > > var tble = crmForm.all.item(fieldN + "_d"); 
> > > > 
> > > > //This is the beginning of our new combobox. It's a standard HTML 
> > > > declaration and all we need to do is to
> > > > //fill the appropriate options. You should check the original HTML code to 
> > > > get the appropriate values for
> > > > //req (field required level) and the tab index. 
> > > > var selection = "<selection req='0' id='" + fieldN + "' name='" + fieldN + 
> > > > "' defaultSelected='' class='selectBox' tabindex='1380'>";
> > > > 
> > > > //The defaultValFd serves as an indicator if the current field value 
> > > > (defaultV) corresponds to one
> > > > //of the options we have inserted into the combobox. If the current value 
> > > > was not found, we will insert it as
> > > > //a separate option, ensuring that the stored value always is displayed. 
> > > > var defaultValFd = false;
> > > > 
> > > > //This is the potential account size list. Empty string is added as the 
> > > > first array element, allowing a user to remove a selection.
> > > > var Optns = new Array(
> > > >    "", 
> > > >    "Ms.",
> > > >    "Mr.",
> > > >    "Mrs.",
> > > >    "Doctor",
> > > >    "Miss"
> > > >  );
> > > > 
> > > > //Now let's add all of the potential account size names as option elements. 
> > > > for (index in Optns) {
> > > > 
> > > >    //Create a new option element and set the value to the current potential 
> > > > account size of the loop. The value provided in
> > > >    //the value attribute will be stored in the database, so you have the 
> > > > option to use ISO codes or numbers
> > > >    //if you want. As I always want to have the full potential account size 
> > > > name stored in the database, I use the full
> > > >    //potential account size name. 
> > > >    selection += "<Optns value='" + Optns[index] + "'";
> > > > 
> > > >    //If this is the default value (the current value stored in the entity), 
> > > > I do two things: first, I add the
> > > >    //SELECTED attribute to the current option, forcing the combobox to 
> > > > select it by default. Second, I set
> > > >    //defaultValFd to true, indicating that I don't need to add the default 
> > > > value to the list after 
> > > >    //exiting this loop.
> > > >    if (Optns[index] == defaultV) {
> > > >       selection += " SELECTED";
> > > >       defaultValFd = true;
> > > >    }
> > > > 
> > > >    //Add the remaining parts of the Optns element. The value specified 
> > > > between <Optns> and </Optns> is
> > > >    //the text displayed in the combobox. In this sample it's identical to 
> > > > the text provided in the value
> > > >    //attribute. 
> > > >    selection += ">" + Optns[index] + "</Optns>";
> > > > }
> > > > 
> > > > //Here's the part that ensures that an existing entity will always display 
> > > > the stored value of the 
> > > > //potential account size field, no matter if it is included in the option 
> > > > list or not. If it is set and it was not found
> > > > //in the previous loop, then defaultValFd will still be false and we have to 
> > > > add it as a separate 
> > > > //option, which is also SELECTED.
> > > > if ((defaultV != null) && (defaultV.length > 0) && !defaultValFd) {
> > > >    selection += "<Optns value='" + defaultV + "' SELECTED>" + defaultV + 
> > > > "</Optns>";
> > > > }
> > > > 
> > > > //Close the open select element. 
> > > > selection += "</selection>";
> > > > 
> > > > //Finally, I replace the entire definition of the text box with the newly 
> > > > constructed combobox. IE is very
> > > > //smart and will instantly update the window. You now have a combobox with a 
> > > > list of all 
> > > > //potential account size and it will be saved directly to the potential 
> > > > account size field. 
> > > > tble.innerHTML = selection;
> > > > 
> > > > 
> > > > 
> > > > Thanks for all help in advance.
> > > > 
> > > > 
> > > > -- 
> > > > Dave Christman
> > > > System Developer
0
Utf
9/25/2007 11:50:01 AM
Reply:

Similar Artilces:

Visual basic and emprt fields
I recently converted from Access 97 to 2003. (we're a little behind the times at my company). Anyway, we have some visual basic code which interfaces with the Access database in order to populate BOM's in AutoCAD, etc. My problem is that the code does not like fields with 'null' values. It didn't seam to mind then in 97? I've since entered a meaningless character in those fields to get the code to function so the company can still run, but is there a 'real' fix? I'm only self taught at VB, but I think it has something to do with an empty records...

drop zero lines from charts
I have a automated chart I create every month. Sometimes there is no data for that month. I'd like the chart to still show that month without the line dropping to zero. I have the data below the chart coming over as blank by formatting the cell to "number" and setting it at "0;-0;;". I was hoping that there is an easy way to have the line in the chart drop off also when there is no data to come over. Thanks in advance -- Baltimore Ravens Hi, With the chart selected choose Tools, Options, Chart, and chose Plot empty cells as Not plotted. -- Cheers, Shane Dev...

what do i type in the pop3 box with a new account
what do i type in the pop3 box with a new account in msoft outlook wayne wrote: > what do i type in the pop3 box with a new account in msoft outlook Depends who your ISP is. Ask them. ...

Money Counts 7 to Quicken 5 conversion...
Does anyone have a suggestion about converting data from Money Counts 7 to Quicken 5? Here is my problem. I want to convert/export my data from MC7 to a format that I can import to a modern application. MC7 supports a conversion using Quicken 5, but I don't have a copy of Quicken 5. Does anyone have any other idea on how to convert data from MC7 to an extensible farmat? Of course, Intuit does not have old versions of their software for download, only patches. Thanks for your help Look on eBay for an old copy of Quicken. <mr.tim.richardson@gmail.com> wrote in message news:11799...

Additional Fields for Items
I have a couple of questions regarding the items part of RMS. 1. Is there an open through MS or an addon available to add more custom data fields on the item database that would be available to put on labels and sort reports by? To answer in advance I am already using the 3 Sub Descriptions offered, but I need more. 2. When making custom labels, is there a way to get the 'Notes' area from the special page to go onto a label? Thanks for any help in advance Hi Steve, One option is not to use the RMS Labels but use Microsoft Word with Mail Merge and labels. This allows you t...

Drag in a List Box
If I have a list box that has a row source to a query is it possible to drag my records up and down the list box to give them a certain order to print on a report?? -- Thanks in advance for any help with this......Bob MS Access 2007 accdb Windows XP Home Edition Ver 5.1 Service Pack 3 Stephen Lebans has a number of Listbox examples on his website. Here's just one of them: http://www.lebans.com/vb_listbox.htm -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.accessmvp.com http://www.mvps.org/access "Bob Vance" <rjvance@ihug.co.nz>...

Sort a numeric field
I want to sort the following in "true value" as opposed to the order that is provided below. My import document provides this format. Maybe not the best explanation, but can you help? Thanks as always - 1000 10000 2000 3000 35000 4000 45000 5000 On Sun, 26 Jun 2005 09:16:02 -0700, "sdmccabe" <sdmccabe@discussions.microsoft.com> wrote: >I want to sort the following in "true value" as opposed to the order that is >provided below. My import document provides this format. Maybe not the best >explanation, but can you help? > >Thanks...

Conversation filter indents do not show up in Outlook 2007?
I created group by conversation filter in outlook 2007. However, responses to emails do not appear to show up indented as they did in Outlook 2003. Maybe I am missing some setting. Any help appreciated. Thanks ...

Updating mapped fields
I made a mapping from account to a contact. The fields that are mapped are the general adress fields. When I create a new contact from an account the adress values from the parent account are used for the new contact. So far so good. My problem is that I want to automatically update the adress fields of a contact when the values change in the parent account. This isn't done automatically by MS CRM. Is there a way to do this? I've tried to create a manual workflow rule that will do this, but that won't work I think. Does anybody have a solution or some pointer for me? Thanks in a...

Contact address fields Outlook 2002
I've converted my Outlook 2000 contacts to Outlook 2002, the address information seems not to be right. The City-info is in the ZIP-field, the state info in the city-field and the zipcode in the state-field. In the 'All fields'-tab the information is in the right fields. I've migrated from Outlook 2000 SP3 English to Outlook 2002 Dutch. It seems some programmer/translator mixed up the addressfields in the contactinformation-window. I need this information for my program. Is this solved in a servicepack/upgrade, or is any workaround available? It seems to be a common probl...

how do i refresh a pivot table drop down list in excel 2003?
when i remove data from my source tab, the entries still show in the drop down list for the field in my pivot table. i am trying to figure out how to remove them. i tried removing the field from the pivot table, refreshing the pivot table, and then placing the field back in. that only works sometimes. ...

which sqlcedatareader method should I call for a numeric field?
I am developing a sql server 2005 ce appliaction. I have a numeric(18,10) filed in my db table. When I call oReader.GetDouble(0) after oCmd.ExecuteReader() and oReader.Read(), I got a sql exception: invalidCastException. So I am confusing... Which other method should I call for numeric field than GetDouble()? Thank you in advance. > So I am confusing... Which other method should I call for numeric field > than GetDouble()? SQL Server numeric and decimal data types map to a .Net decimal. See http://msdn.microsoft.com/en-us/library/4e5xt97a(VS.80).aspx for a com...

Failed conversion from MS Money 2002 to MS Money 2008
I was wondering if someone could help. I am trying to convert an msn money 2002 file to msn money 2008 for a client. I have gone through all the various posts and faq's on the internet and I have read various suggestions on the subject...so I have tried so far the following: installed trial edition of ms money 2004....2007, 2008...all of which come back with the dreaded...incompatible version error....i even tried installing ms money 2002 on a different laptop and thaqt came back with exactly the same error message. The problem from what I can gather is that the MS Money 2002 insta...

Separating field information
I need some help. Can this be done with queries? Database has 13,000 records All records are identical except for the History Field that will contain one number 1, 2, 3, or 4 In a query that contains no records with a history of 2 select the records with a history of 1 but not 3 or 4. In a query that contains no records with a history of 1 select the records with a history of 2 but not 3 or 4. Thanks for your help. Marv Trott That is unclear to me. You must be leaving out some necessary detail, since the way I read your post all you need to do is apply criteria of =1 for t...

How sort recordsets with fallback tiebreak fields
Access 2007 developing 2003 database DAO I have a recordset I want to sort in ascending order of field "localOrder" (Long). Sometimes there will be ties. In such cases I want it to decide on ties by sorting on UrgencyID (Long). If there are still ties, I want it to sort by "whenAssigned", which is a Date +Time field. I tried the following code, Set rst = CurrentDb().OpenRecordset( _ "SELECT taskID, whenAssigned, UrgencyID, localOrder FROM tbl_tasks " & _ "WHERE personIDassignedTo = " & myID & _ ...

Closing a PO causes Approved By field to be changed
We use Purchase Order Approvals in the Purchase Order Enhancements module. We recently discovered that the field POA_Approved_By (which normally contains the user ID of the person who approves the PO) is updated with the name of the person that closes the PO (if it's manually closed). Does this make sense? Because of this, we don't have a record of who originally approved the PO. -- Bud Cool Microsoft Certified Business Management Solutions Specialist, GP 9.0 Financials Currently supporting: GP 9.0, SP2 ...

Restrict a Text Box
Can you restrict a text box to only one line, my text box only shows one line! -- Thanks in advance for any help with this......Bob MS Access 2007 accdb Windows XP Home Edition Ver 5.1 Service Pack 3 Bob, In size or in characters? Not sure I understand... -- Gina Whipp 2010 Microsoft MVP (Access) "I feel I have been denied critical, need to know, information!" - Tremors II http://www.regina-whipp.com/index_files/TipList.htm "Bob Vance" <rjvance@ihug.co.nz> wrote in message news:ONinxuVxKHA.1692@TK2MSFTNGP04.phx.gbl... Can you re...

Drop down *buttons* in toolbars
How can I create drop-down (or pull-out) *buttons* in toolbars? All the examples I have found tell me how to create a drop-down *menu* - which isn't what I need. You can see examples of this in MS Word (for instance the border toolbar button). Thanks in advance. Sandeep What you see in Word is not a toolbar. That functionality(pull out menu) is not included in common controls. You will have to develop it yourself or buy some 3rd party library such as www.codejock.com etc. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "Sandeep Pulla" <bogusami@hotmail.com> wrote in me...

How to advance date field by one day on mouse click?
I have a date field in a form and I want to be able to advance whatever date is presently in it by one day with a click of the mouse. What do I enter in the On click property of the field? Thanks. "SamJ" <me@nospam.co.uk> wrote in message news:MPG.2224e53f6638ce999896e7@news-text.blueyonder.co.uk... >I have a date field in a form and I want to be able to advance whatever > date is presently in it by one day with a click of the mouse. What do I > enter in the On click property of the field? > Thanks. Better to use the + and - keys, but here's the code you ne...

Office XP & Works Suite 99 spreadsheet conversion
I've a couple of spreadsheets written in the spreadsheet facility of Microsoft Works Suite 99 (file extensions .wks). I installed Office XP & deleted Works Suite software, assuming that Excel in Office XP could open the spreadsheets - but it seems I was wrong. Any way I can open .wks in .xls without reloading Works Suite (assuming I can find it)? Generally you would normally open the file in WORKS and then save it down as a file that Excel can read. .xlr is a native Excel format, or .txt, .csv, dbaseIV are all formats it can read. You can also find a converter here if you d...

Limit text box to any character except \, /, :, ?, <, >, !
Hello- I am currently working in a form which contains a text box that a user will use to create a job number and another text box for the job name. Later in the same form, the user will have the ability to create certain directories based upon this job number and another directory based upon the job name. I would like to put a function behind the after_update event of each event that will review this text box and make sure that the string entered does not contain any character that would cause a conflict when creating a directory, namely the following \ / : ? < > ! characters. What ...

Font size and type drop downs on formatting bar inoperative
The font size drop down menu on the formating bar appears empty when attempting reformat text and the font type drop down is inoperative. Both can be formated using the Format drop down from the menu bar Have you tried an Office Diagnostics in the Help menu? Not sure why you cannot select fonts or font size unless your cursor isn't in the text box. If you just select the text box, the fonts are not active. What version Publisher are you using? -- Mary Sauer http://msauer.mvps.org/ "mantor" <mantor@discussions.microsoft.com> wrote in message news:5B28C...

Summing fields between two dates
I think I know how to do this but any extra help would be appreciated. I have a table with four fields - net sales, payin date, payin number, and payin amount. What I want to do is create a query that will summarize all of the amounts in "net sales" within a specified date range. I thought an expression reading SUM([net sales]) BETWEEN [start date] AND [end date] would work, but it doesn't. Suggestions? -- Für Elise - Support the Breast Cancer & Heart Foundations SELECT SUM( [net sales] ) FROM tableNameHere WHERE fieldWithDateHere BETWEEN [start date] ...

Hardware for CRM 1.2 and SBS 2003 box
I'm just getting into MS CRM and would like to build a box with SBS 2003 and MS CRM 1.2 but the hardware spec's seem to be a bit much. I'm looking for low costs alternatives, any ideas? -- Dennis You can exist with lesser hardware, but performance will be impacted. The compenents all use a lot of resources (especially SQL & Exchange), so it all depends on how much usage the box will get. I run my demo environments off Virtual PC images hat run on my notebook, so it can definately be done. Matt Parks MVP - Microsoft CRM ---------------------------------------- ---------...

Cannot see send/receive dialog box
I'm using outlook 2003 w/sp2. When I click on the send/receive button at the top the send/receive dialog box doesn't pop up like it used to. Please advise and thanks in advance. Thanks "john doe" <johndoe@johndoe.com> wrote in message news:OcTn%23A%23bIHA.5348@TK2MSFTNGP03.phx.gbl... > I'm using outlook 2003 w/sp2. > When I click on the send/receive button > at the top the send/receive dialog box > doesn't pop up like it used to. > Please advise and thanks in advance. > Thanks Mr. Doe, :-) Please try: Tools -> Send/Receive -> Send...