Skip to Content
author's profile photo Former Member
Former Member

NW Java CE 7.1: Input field disabled after binding of a model element

Hello,

I am new to the world of web dynpro java - and have a question concerning an easy web dynpro application:

I created a model based on a WSDL file and conducted the mapping (model --> component controller context --> view context).

Now i want to bind a context element of the model to an input field of a view, but after doing that and deploying the application the input field is disabled - though the input field readonly and enabled properties are set to 'false' respectively 'true'.

Are there any suggestions for a solution?

I also wasn't able to change the element value of the bound model attribute by coding - is that possible at all?

Thanks in advance,

Falk

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 14, 2009 at 05:31 PM

    Hi Falk,

    Welcome to the SDN!

    In the begging often we get this problem. We need to initialize the model nodes that we use for input.

    Similar problems are discussed in the following threads. Please check them.

    [thread 1|input-field-is-inactive]

    [thread 2|disabled]

    If you search this forum you will get more solved threads.

    Regards,

    Siva

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 15, 2009 at 05:21 PM

    Hi,

    thanks a lot for the link. I had a closer look a the following thread

    input-field-is-inactive)

    and tried to rebuild the given example.

    My wdoInit mehtod of the component controller looks like this - the input field is still disabled:

    //creating an instance of the Model

    MyModel model = new MyModel();

    //creating an instance of the model class

    Request_GetWeatherByZipCode zip = new Request_GetWeatherByZipCode(model);

    // adding an instance of the model element to the object

    wdContext.nodeRequest_GetWeatherByZipCode().addElement(wdContext.createRequest_GetWeatherByZipCodeElement(zip));

    // binding the object to the Content

    wdContext.nodeRequest_GetWeatherByZipCode().bind(zip);

    Unfortunatley I wasn't able to run the following method for setting an attribute to the object like suggested

    zip.setGetWeatherByZipCode(new GetWeatherByZipCode(model));

    --> if I'm trying to implement this, an error is shown (GetWeatherByZipCode cannot be resolved to a type).

    Has anybody an idea why this is error occurs or can anyone give a hint concerning coding mistakes?

    Thanks in advance,

    Falk

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Falk,

      Can you try this code please?

      MyModel model = new MyModel();
      //creating an instance of the model class
      Request_GetWeatherByZipCode zip = new Request_GetWeatherByZipCode(model);
      // binding the object to the Content
      wdContext.nodeRequest_GetWeatherByZipCode().bind(zip);

      If you get any errors then organize imports using CtrlShiftO and rebuild the project.

      Regards,

      Siva

  • author's profile photo Former Member
    Former Member
    Posted on Jan 16, 2009 at 09:11 AM

    hi,

    i inserted the coding, and now i receive an error message (i.e. the disabled label respectively the browser screen isn't shown at all):

    com.sap.tc.webdynpro.progmodel.context.ContextException: NodeElement(.MyWeatherComp.Request_GetWeatherByZipCode): model node element cannot be created without a model instance

    i'm quite new to the java programming language, but asking myself if we didn't create the model instance in the coding above.

    what could still be wrong?

    regards,

    falk

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 16, 2009 at 09:56 AM

    Hello Siva,

    I tried your coding - without any error, but unfortunately the input field is still disabled. I also can't imagine that I've done the mapping wrong...

    Are there any other ideas (i'm running out of them...)?

    Falk

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Falk,

      I have given some sample code to create model instance and bind it to context. But you need to do it for your all input context nodes.

      //creating an instance of the model class

      xxxx var_name = new xxxx(model);

      // binding the object to the Content

      wdContext.node<name>().bind(var_name);

      Particularly you need to do it for the node which consists the attribute that bound to input field.

      And carefully check the context mapping as well as the context binding.

      Regards,

      Siva

  • author's profile photo Former Member
    Former Member
    Posted on Jan 16, 2009 at 01:36 PM

    Hi,

    finally... i found the answer - and it was quiet simple: i forgot to import the package/class 'GetWeatherByZipCode':

    import mymodel.MyModel;

    import mymodel.Request_GetWeatherByZipCode;

    import mymodel.GetWeatherByZipCode;

    import mymodel.myweatherapp.comp.wdp.IPrivateMyWeatherComp;

    import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;

    After that the code suggested in thread

    input-field-is-inactive

    worked fine:

    MyModel model = new MyModel();

    Request_GetWeatherByZipCode zip = new Request_GetWeatherByZipCode(model);

    zip.setGetWeatherByZipCode(new GetWeatherByZipCode(model));

    wdContext.nodeRequest_GetWeatherByZipCode().addElement(wdContext.createRequest_GetWeatherByZipCodeElement(zip));

    Thanks @all for your help!

    Falk

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.