cancel
Showing results for 
Search instead for 
Did you mean: 

Input Field is inactive

Former Member
0 Kudos

Hi ,

I am using an input field to get 'zipcode' and submit button; to display the weather forecast in a table using a webservice.

All the context mappings are correct and the properties are,

Enabled

Read-only -> false

Visible

value -> Request_GetWeatherByZipCode.GetWeatherByZipCode.ZipCode

It has a label and the input field is inside a group (input field, label and submit button)

Everything is fine.

But When I deploy and run, the input field appears but is inactive and I could not enter any value into it.

Can any of the experts know why an input field might go inactive at runtime?????

please help me as it is very urgent and trivial.

Thanks,

Aravind.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I can see the input field. But cant enter values to it.

But I can click the Submit button.

Both are in under same group.

Have any body tried that procedure?

I think we need to initialize the element as Gopal said.

But still it is not working.

Some body please try at your end. As I need to complete this assignment by today.

Thanks,

Aravind.

Former Member
0 Kudos

Hi Aravind,

I will try from here. Give me some time.

Regards,

Gopal

Former Member
0 Kudos

HI Aravind,

What is you Web service model name?

Regards,

Gopal

Former Member
0 Kudos

HI Aravind,

If your web service name is WS then put following code in your wdDoInit

WS model = new WS();
    Request_GetWeatherByZipCode zip = new Request_GetWeatherByZipCode(model);
    zip.setGetWeatherByZipCode(new GetWeatherByZipCode(model));
    
    wdContext.nodeRequest_GetWeatherByZipCode().addElement(wdContext.createRequest_GetWeatherByZipCodeElement(zip));

In executeRequest_GetWeatherByZipCode() of Component Controller write following code:

try {
		wdContext.currentRequest_GetWeatherByZipCodeElement().modelObject().execute();
	} catch (Exception e) {
                 wdComponentAPI().getMessageManager().reportException(e.getMessage(),true);
	}

Regards,

Gopal

Answers (10)

Answers (10)

Former Member
0 Kudos

Hi Gopal,

The problem is solved after I have added your code

AND

more importantly when I did Source -> Manage Imports.

Thanks very much for everybody,

Aravind Arumugam.

Former Member
0 Kudos

Hello aravind,

Try this:

You create a context element and bind that to the UI element (input field), and in code wdInit() method yo uassign the context element to the input element to the WebService.


// write this code in wdInit and try to deploy
wdContext.currentWeatherCtxNodeElement().setZipCode( wdContext.currentContextElement().getZipCode());

In some cases you cannot directly bind the context element to UI elements.

Regards

Vinod V

Former Member
0 Kudos

Hi Gopal,

I have copied the code.

But in the WdDoInit method, i'm getting a syntax error at the following line,

zip.setGetWeatherByZipCode(new GetWeatherByZipCode(model));

which is,

"GetWeatherByZipCode cannot be resolved or not a type."

Thanks

Aravind

Former Member
0 Kudos

Hi

Are you binding value of input field directly through model node,

if it is so then just try to bind it with value node.

Create a value node of similar attribute as model node and map it syntactically.

Hope this will enable your input field.

Mandeep Virk

Former Member
0 Kudos

Hi,

There is no cardinality for "Input Field".

So the only solution is as Gopal said,to include the code.

I have included the code,

wdContext.nodeRequest_GetWeatherByZipCode().bind

(wdContext.createRequest_GetWeatherByZipCodeElement(new Request_GetWeatherByZipCode( new WS_Weather())));

My doubt is should I give a new model instance? (see BOLD).

But still it is not working.

Is there any solution to modify this code and make the input field active?

regards,

Aravind

Former Member
0 Kudos

hi..

Inactive means in the sense.. u can see the input field , but u cant enter values... or u cant able to see input field itself?

GS

Former Member
0 Kudos

Hi,

I now realize that the problem is the cardinality.

And i have to change it to 1..1

As I have read that 0..1 makes the element to disable if there is no initial value.

I am very new to Web Dynpro. And to be honest this is my second demo I'm working through. But i have decided not to leave home before executing this successfully.

So can anybody tell how to change the cardinality to 1..1?

Thanks,

Aravind.

Former Member
0 Kudos

Go to properties of Node for which you want to change cardinality. There you change the cardinality.

Former Member
0 Kudos

Hi Arvind,

Open the view.....

go to the Layout Tab.....

click on the inputField.....

now the properties will be shown in the properties area at the bottom...

check for the cardinality property.....

change the value to 1..1.

Regards,

Sudheer.

Former Member
0 Kudos

Hi Arvind,

In Context Tab>select the node>properties>at bottom u can see the cardinality property>change tht to 1..1

GS

Former Member
0 Kudos

Hi Sudheer.

Sorry to correct you. There is no cardinality property for InputField.

Regards,

Gopal

Former Member
0 Kudos

hi,

this problem is because u r not creating any element for that node.

for creating element u have to use the way which Gopal has discussed above,

and if u don't want to create this by that way than u can change the cardinality 1...1 by which u don't need to create any element for that node.

because it will automaticaly create an elemrnt.

Regards

Trilochan

Former Member
0 Kudos

Hi,

My "Submit" button is active. But only the input field is not active.

I have added the following code in WDdoInit() method,

wdContext.nodeRequest_GetWeatherByZipCode().bind

(wdContext.createRequest_GetWeatherByZipCodeElement(new Request_GetWeatherByZipCode( new WS_Weather())));

But still it is inactive.

Is there anything I am missing?

Please help,

Aravind.

The procedure that I am following was this,

Procedure:

1. Start the SAP NetWeaver Developer Studio:

2. Create a new Web Dynpro Project

File → New → Web Dynpro Project

For the project wizard, enter S20100_Weather for project name, use Default project contents and click Finish:

3. Create an Application

Right click on Applications and select Create Application:

Enter Weather for Name and edu.uwm.s20100.weather for package followed by Next:

4. Create a Web Dynpro Component

Right click on Web Dynpro Components and select Create Web Dynpro Component:

Enter WeatherComponent as a component name, edu.uwm.s20100.weather as component package, Location as the view name and then click Finish:

5. Create a second View

Expand the Web Dynpro → Web Dynpro Components → WeatherComponent → Windows → WeatherComponent path

Right click on WeatherComponent and select Embed View:

Select Embed new View and click Next:

Enter WeatherForecast as the View Name and click Finish:

You now have two views – Location and WeatherForecast:

6. Specify the navigational scheme:

Right click the Location View and select Create Outbound Plug:

Name the Outbound Plug ToWeather:

Repeat this process adding both an Outbound and Inbound plug to each view. Use the following names for the plugs:

Outbound Plug Inbound Plug

Location View ToWeather FromWeather

WeatherForecast View ToLocation FromLocation

Click on the Link Icon and draw a line from the outbound plug Location to the inbound plug WeatherForecast. Repeat this process from the outbound plug WeatherForecast to the inbound plug Location:

6. Create Actions and Implement Navigation

Double click on the Location node under views and select Actions Tab:

Click on the New button. Enter Submit for the Name and Submit for the Text. Select ToWeather from the drop down list as the Fire Plug, click Finish:

This newly created Action will be used to transfer control from the Location view to the WeatherForecast view:

Repeat this process for the WeatherForecast view, using Return for Name, Return for Text and ToLocation as the Fire plug.

Clicking on the Implementation tab will display the generated code for each action:

7. Design the Location View Layout

Double click on the Location under View. Select the Layout tab in the middle window and the Properties tab in the lower window. Selecting the RootUIelementContainer allows you to edit this invisible container for all the elements of this view.

Change the properties of RootUIelementContainer to the following:

Property Value

layout GridLayout

cellPadding 5

colCount 2

Right click on RootUIelementContainer and select Insert Child to add a new element:

Enter Group for Type and LocationGroup for Id and then click Finish:

Right click on DefaultTextView and select Delete:

Right click on InputGroup and Insert the following elements (children):

Type Id

label ZipCodeLabel

inputField ZipCode

button Submit

Change the following properties:

Element Property Value

InputGroup layout GridLayout

cellPadding 1

colCount 2

InputGroup_Header text Enter Location

ZipCodeLabel text Zip Code

labelFor ZipCode

paddingTop large

ZipCode tooltip Enter zip code here

value (leave blank)

Submit toolTip To weather

Events>OnAction Submit

paddingTop Large

After changing the properties, the Location view layout should appear as follows:

8. Design the WeatherForecast View Layout

Double click on the WeatherForecast View. Select the Layout Tab and the properties tab. Right click on RootUIelementContainer and select Insert Child to add the following element:

Type Id

group WeatherGroup

Right click on DefaultTextView and select Delete.

Right click on WeatherGroup and Insert the following elements (children):

Type Id

table WeatherTable

button ReturnButton

Change the following properties:

Element Property Value

RootUIElementContainer layout GridLayout

cellPadding 5

colCount 1

WeatherGroup layout GridLayout

cellPadding 1

colCount 1

WeatherGroup_Header text Weather Forecast

WeatherTable dataSource (blank)

ReturnButton tooltip Go the location

padding top Large

Event>onAction Return

After changing the properties, the WeatherForecast view layout should appear as follows:

9. Import a Web services model (based on WSDL) into project to retrieve weather data

in the project structure, expand the node Web Dynpro → Models:

Right click on Models and select Create Model:

Select Import Adaptive Web Service Model and click Next:

Enter WeatherModel for model name and edu.uwm.s20100.weather.model as the model package. Select Local File System or URL and click Next:

Select No logical destinations and click Next:

Note: The web address for the WSDL file for the weather Web service is http://www.webservicex.net/WeatherForecast.asmx?WSDL. Do to a limitation of the current version of web Dynpro, it is necessary to have the WSDL saved as a local file. A file is included in the drive F:/ globalweather.wsdl, which is a copy of this file, store it on your local machine and browse to this file.

Browse for the local file (globalweather.wsdl) and click Next:

Accept the default names and click Next:

View the import log and click Finish:

View the data model for the Web service:

10. Add the model to Weather Component

Right click on Used Models and select Add:

Select WeatherModel and click OK::

Note: Since we choose no logical destination, the model does not appear used models diagram.

11. Create a context for the custom controller

Double click on WeatherComponent, right click on component controller and select Apply Template:

Select Service Controller followed by a Next:

Select Request_GetWeatherByZipCode followed by Next:

Select ZipCode and all fields in the WeatherData group and click Next:

Accept method name and click Finish:

Click on the Component Controller and then double click on the WeatherModel to view the context mapping:

12. Add dependencies to views

Double click on Location in Views group and select Properties tab in the middle right window:

Click Add under required controllers. Select (check) WeatherComponent – eud.uwm.s20100.weather and click OK:

Repeat this process for the WeatherForecast view, Selecting (check) WeatherComponent – eud.uwm.s20100.weather.

13. Create a context for the Location

Click on Location under Views and select Context tab in the middle right window. Right click on Context and select New → Model Node:

Enter Request_GetWeatherByZipCode and click Finish:

Right click on Request_GetWeatherByZipCode and select Edit Context Mapping…:

Select Request_GetWeatherByZipCode and click Next:

Select ZipCode and click Finish:

The context appears as follows:

14. Create a context for the WeatherForecast

Click on WeatherForecast under Views and select Context tab in the middle right window. Right click on Context and select New → Model Node:

Enter Request_GetWeatherByZipCode and click Finish:

Right click on Request_GetWeather and select Edit Context Mapping…:

Select Request_GetWeatherByZipCode and click Next:

Select WeatherData and click Finish:

The context appears as follows:

15. Editing UI elements

Select Location under Views, Layout tab in middle right window and Properties tab in lower right window.

Click on the ZipCode element and click on the … for it’s value property and select ZipCode from the context:

The layout of the view appears as follows:

Select WeatherForecast under Views, Layout tab in middle right window and Properties tab in lower right window.

Right click on WeatherTable and select Create Binding:

Select (check) WeatherData and click on Finish:

The layout of the view appears as follows:

The table elements become (Note – the weather graphic was dropped):

16. Implement backend connection

Double click on Location under windows, select Implementation tab in the middle right window and locate the onActionSubmit in the code:

Add the following line of code proceeding the existing line:

wdThis.wdGetWeather_Demo_ComponentController().executeRequest_GetWeatherByZipCode();

17. Deploy and Run

Former Member
0 Kudos

Hi,

Have you invalidated the node

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Aravind,

let me know....what is the cardinality of the node therfore of attribute bound to the inputfield.

select the inputfield in the layout.

in the properties area....

check the Cardinality it shud be 1...1

regards,

Sudheer

Former Member
0 Kudos

Hi,

i suspect its the problem with the cardinality of the node in which the attribute that is bound to the inputfield.

make sure the cardinality is 1..1 for the attribute bound to inputfield.

hope this helps,

regards,

Sudheer

Former Member
0 Kudos

Hi Aravind,

As you have not created any element for the node, input field is showing disabled. To enable it you have create and element and bind it. Following is the code:

In wdInit write following:

wdContext.nodeRequest_GetWeatherByZipCode().bind(wdContext.createRequest_GetWeatherByZipCodeElement(new Request_GetWeatherByZipCode());

Try to understand the code and come back if you are unable to understand what the code is doing exactly.

Regards,

Gopal

Former Member
0 Kudos

Make Sure u had initialized ur context node, in ur wddoinit().

If the node dosent have any elements then all the elements bound to that node appear disabled..

Regards,

Ravi Kumar P