cancel
Showing results for 
Search instead for 
Did you mean: 

Blank line in dropdownlistbox with helpValues

Former Member
0 Kudos

Hello at all,

how can I get a blank line in a dropdownlistbox, which get's the values with helpValues.

In the helpValues there is no blank line.

Thanks in advanced.

Tina

Accepted Solutions (1)

Accepted Solutions (1)

RieSe
Contributor
0 Kudos

Hi,

if you use an internal table append an initial line to it. Otherwise add an empty listbox element.

Best regards, Stefan

Former Member
0 Kudos

Hi,

how can I get an empty listbox element?

This code doesn't work.


<htmlb:dropdownListBox id                = "ddid"
                                   selection         = "//model/selfield"
                                   nameOfKeyColumn   = "keycol"
                                   nameOfValueColumn = "valcol"
                                   helpValues        = "//model/selfield" >
              <htmlb:listBoxItem key = ' '
                                          value = ' ' />
</htmlb:dropdownListBox>

athavanraja
Active Contributor
0 Kudos

<htmlb:dropdownListBox id = "ddid"

selection = "//model/selfield"

nameOfKeyColumn = "keycol"

nameOfValueColumn = "valcol"

helpValues = "//model/selfield" >

here you are using data binding, and the help values comes directly from the domain of the referenced field (reference by the variable //model/selfield) in such a case i am not sure whether you can locally (at bsp level) modify that to have an empty line.

if your <htmlb:dropdownListBox had used table parameters, then the solution is to simply add a empty line at the beginning of the itab

athavanraja
Active Contributor
0 Kudos

or you can use the following javascript approach.

< script>

var myselect = document. getElementById("ddid");

myselect. options[0] = new Option('NewoptionElementtext', 'NewoptionElementvalue');

< /script>

note: remove the leading space in < script and < /script and also the space after document. and myselect.

declare this javascript just below your htmlb:dropdown.... declaration

Former Member
0 Kudos

Hi Durairaj,

using the javascipt approach sounds like a solution. But it doesn't work.

There is no blank line in my dropdownlist.

Do I have to do more settings (e.g. directives or others) for usind javascript? I had never worked with js.

Thanks in advanced,

Tina

athavanraja
Active Contributor
0 Kudos

i have tested the code before posting.

make sure that the js is declared after the declaration of htmlb:dropdownlistbox

do you see js error (yellow icon) in the browser status bar?

instead of passing blank, try just passing something like -select- etc.

Former Member
0 Kudos

Yes, I get a JS error "object required" in my main-controller.

Can I depug this JS?

athavanraja
Active Contributor
0 Kudos

can you post your code in the view where you wrote the htmlb:dropdownlistbox and the javascript .

whats the id of the dropdown htmlb element , the same has to be used in the js

document. getElementById("ddid");

instead of ddid use the id you have set for htmlb:dropdownlistbox

or post your view layout code here

Former Member
0 Kudos

I used the id of htmlb:dropdownlistbox for document. getElementById.


<htmlb:dropdownListBox id   = "ddezasp"
                                   selection         = "//kunde/bkto_change.ezasp"
                                   nameOfKeyColumn   = "ZAHLS"
                                   nameOfValueColumn = "TEXTL"
                                   helpValues        = "//kunde/bkto_change.ezasp" />
            < script>
            var myselect = document. getElementById("ddezasp");
            myselect. options[0] = new Option('', '');
            < /script>

The code in my view is without leading spaces.

Edited by: Tina Trenkler on Feb 12, 2008 1:15 PM

athavanraja
Active Contributor
0 Kudos

if the error say object required, i guess the following line is having problem

var myselect = document. getElementById("ddezasp");

can you do a view source of your page (view) and see what is the id for dropdownlistbox. (<select tag)

just to make sure that the system is not appending anything to the id.

Former Member
0 Kudos

Your are right. I'm using mvc and the system appends the controller ID to this element id.

Now it works without error.

Thanks a lot.

Answers (0)