Page 1 of 1

BSP Tag thtmlb:dropdownListBox

PostPosted: Fri Jul 13, 2012 5:51 am
by DrSidewalk
I'm using the standard thtmlb:dropdownListBox tag within my BSP code. The problem that I have is that the value of the field (let's say it's 'XYZ') does not match any of the entries in the drop-list value table provided, because the data came from an external source and has been identified as incorrect and therefore is in the BSP code (component/view) in order to correct the value. So, this dropdownlisbox tag simply shows the first entry of the drop-down table because the value 'XYZ' is not in the list. This is not good as the customer no longer has visibility of the original value, even though it needs to be corrected.
Now I could simply insert the value passed in (assuming it's not in the list) as the first entry of the drop-down value table, or have the first entry in the dropdown value list defaulted as something like "Invalid entry,please re-choose". But, that would mean that when the user displays the drop down list the incorrect value 'XYZ' appears in the list to choose from, which would be wrong, or the value of 'XYZ' is replaced with the first entry in the dropdown valie list, being "Invalid entry,please re-choose", but again in this case the user can no longer see the original value.

Has anyone hit this dilemna and overcome it?.

Dr Sidewalk.

Re: BSP Tag thtmlb:dropdownListBox

PostPosted: Wed Aug 01, 2012 9:47 am
by DrSidewalk
I know have a theoretical solution to this problem, if only I could get it to work.

There are two solutions here:

1). The field value is 'XYZ', but this value is not a KEY or VALUE entry in the dropdownlistbox itab and therefore will always default the field to whatever the first entry is in the itab. One solution is to display a standard inputfield tag followed by the dropdownlistbox tag with a width of zero, so that the field does not actually display, but he dropdown arrow still displays. So, this will show the input field and then a drop down indicator. The value 'XYZ' is still displayed and the user can then see that this is invalid (once I make it display a red box around the field), they'll then use the dropdown list, select a VALID entry and a RST (Round Server Trip) will re-display the screen. This time around I will check whether the field value is in the dropdownlistbox itab, which it will be, so display a dropdownlistbox instead of an inputfield followed by a dropdownlistbox. The logic for this and HTML code is all defined in a class method.

2). Display the dropdownlist box, and then overlay the inputfield tag on top of this, so the same look and feel exists with an input field showing the 'XYZ' value and having a dropdown arrow icon at the end. I have been trying to get this option to work (using css and z-index) both upto now have been unsuccessful. I basically have an HTML Grid and GridCell, followed by an thtmlb:dropdownlistbox and thtmlb:inputField tags. However the thtmlb:inputField always seems to appear on the next row and never seems to overlay. Is there some knack to get this to work?.

Dr Sidewalk

Re: BSP Tag thtmlb:dropdownListBox

PostPosted: Mon Aug 06, 2012 4:08 pm
by shobhitcrm
The best solution is to restrict the value to be entered in that field, you should put a check for the incorrect value and raise a message and do not save those value in that field. The users will change the value from the ddlb based on the error message.

SAP CRM Consultant

Re: BSP Tag thtmlb:dropdownListBox

PostPosted: Fri Aug 10, 2012 8:29 am
by DrSidewalk
That's fine if there is just one error. If there are two or three then raising a message is not ideal, and hence the reason for placing a red box around tthe field. This is a bespoke application where the data is not entered via the screen, it comes in as an xml string and this application (component and views) simply displays it and allow the customer to make changes. There are of course some checks beforehand to identify incorrect data.

The inputfield tag has an 'errorState' parameter which you can set to "ERROR" to indicate that a red box should be placed around teh field. But as I'm not using a context and attribute I don't have the field structure in place where I can indicate an error. My data (for reasons that I will not go into here ) is sourced directly from the compoennt controller attribute. I therefore need to the tag to use the appropriate css class to indicate an error. There is a parameter called 'cssclass', so I may mess around with that as well to see if I can force the Inputfield tag into an error state so that it places a red box around teh field.

Dr Sidewalk