cancel
Showing results for 
Search instead for 
Did you mean: 

Length of InputField ...

zbynek_kabrt3
Participant
0 Kudos

Hello,

do you know how is it possible to set InputField length? I know how to set fix length but I need to pass the length through URL parameter.

Thanks in advance!

Regards

Zbynek

Accepted Solutions (1)

Accepted Solutions (1)

roberto_tagliento
Active Contributor
0 Kudos

each UI properties could be binded to context attributes.

****************

IWDProtocolAdapter protocolAdapter = WDProtocolAdapter.getProtocolAdapter();

IWDRequest request = protocolAdapter.getRequestObject();

String paramValue1 = request.getParameter("<URL Parameter name>");

http://help.sap.com/saphelp_nw2004s/helpdata/en/44/be65751c743959e10000000a1553f6/content.htm

******************************

Regards Roberto

roberto_tagliento
Active Contributor
0 Kudos

/people/community.user/blog/2007/08/20/open-views-in-non-modal-external-windows--the-patch-version

zbynek_kabrt3
Participant
0 Kudos

I created new Value Attribute in context of my View. It's called customTitleLength. Then I inserted following code into method wdDoInit() of View Class.

String prefixID = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("prefixId");

if ((prefixID == null) || (prefixID.length() < 1)) prefixID = "";

int prefixLen = prefixID.length();

if (prefixLen > 0){

int titleLen = 55 - prefixLen;

wdContext.currentContextElement().setCustomTitleLength(titleLen);

}

else{

wdContext.currentContextElement().setCustomTitleLength(55);

}

At the end I mapped InputFields' parameter Length to the attribute customTitleLength.

But it doesn't work. It seems the attribute is filled after view rendering.

Could you ensure me that the method is executed before view rendering? Or could you advice to me where could I put the code?

Thank you!

Zbynek

Former Member
0 Kudos

Hi,

Following will be an alternative approach

1) Create a calculated attribute of type integer(Ex: LabelLength)

2) in the getter of this method code as follows



public int getLabelLength(IPrivateTestCompView.IContextElement element)
  {
    //@@begin getLabelLength
//Use the following method in latest version
// String prefixID = WDProtocolAdapter.getProtocolAdapter().getRequestParameter("prefixId");

	  String prefixID = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("prefixId");
	  
	  if ((prefixID == null) || (prefixID.length() < 1)) prefixID = "";
	  int prefixLen = prefixID.length();
	  if (prefixLen > 0){
		  int titleLen = 55 - prefixLen;
		  return titleLen;
	  }
	  return 55;
    //@@end
  }

Bind this attribute to the length property of the inputfield.

Regards

Ayyapparaj

zbynek_kabrt3
Participant
0 Kudos

thank you very much! now it works

zbynek

Answers (2)

Answers (2)

nikhil_bose
Active Contributor
0 Kudos

1) create a parameter "Url" in the interface view out plug

2) generate url for the target application.

3) add parameter to the url


String url = WDURLGenerator.getAbsoluteWebResourceURL(
				
wdComponentAPI.getDeployableObjectPart());
url = url + "param1="+length;
wdThis.wdGetMyInterfaceViewController().wdFirePlugOut(url);

n¡k¡L

Edited by: Nikhil Bos on Jun 24, 2008 6:18 PM

Former Member
0 Kudos

HI Just try this code

Map urlParameters = new HashMap();

// get URL parameter value entered by user, stored in context attribute u2018UrlParamValueu2019. Put parameter u2018hugou2019 in the sneak preview version.

urlParameters.put("hugo",wdContext.currentContextElement().getUrlparametervalue());

if it useful give me points pls