Skip to Content
avatar image
Former Member

fields added after pressing a link

Hello. I have 4 INPUTFIELDs in a row and LinkToAction under them. What I want is that after clicking on the LinkToAction another 4 InputFields drop under first row

InputField1-- -InputField2 -InputField3 ---InputField4

add new InputFields (we press that and new line appears)

InputField1-- -InputField2 -InputField3 ---InputField4

InputField1'1-- -InputField2'1 -InputField3'1 ---InputField4'1

underlineadd new InputFields

If I click on add new InputFields again third row of InputFields appears and such opperation need to be possible upto 4 times. Any ideas? Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jan 10, 2008 at 11:23 AM

    Hi,

    Welcome to SDN.

    Is it a table row where you want to add set of 4 inputfields?

    If yes then you need to create the element of the node bound to the dataSource property of the table.

    Or you can add inputField dynamically onAction of the link any number of times like this:

    IWDInputField inp = (IWDInputField) viewObj.createElement(IWDInputField.class,"inp");

    inp.bindValue(addrTypeInfo); // To bind attribute to inputfield

    trans.addChild(inp); // To add it to the root container

    thanks & regards,

    Manoj

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 10, 2008 at 11:32 AM

    Hi,

    " and such opperation need to be possible upto 4 times."

    If this four times is fixed then you can acheive this as follows

    Create a context attribute of type int in the context.

    Ex: counter ->

    In the init initialise this to 0.

    *Create three context attributes of type WDVisibility and initialise them to WDVisibility.NONE*.

    Ex: Row1Visible

    Row2Visible

    Row3Visible

    Create all inputs as shown below at design time map them to

    corresponding context attributes.

    Create a Transparent container and set the layout to grid Layout Rows=4 and cols=4 (Or a Matrix Layout)

    InputField1---InputField2-InputField3---InputField4

    InputField1---InputField2-InputField3---InputField4

    InputField1---InputField2-InputField3---InputField4

    InputField1---InputField2-InputField3---InputField4

    Now at design time bind the Row1Visible attribute created previously to the Visibility property of all the input fields in the Second Row.

    Similarly bind the other two attributes to third and forth

    Place your Link to Action UI Element below the transparent container created.

    Create a action Handler for the link to action Ui Element

    In the action handler

    check the value of the context attribute counter based on the value set the visibility of the attributes from WDVisibility>NONE to WDVisibility.VISIBLE.

    Ex:

    int x= wdContext.currentContextElement().getcounter();

    switch(x)

    {

    case 1:

    wdContext.currentContextElement().setRow1Visible(WDVsibility.VISIBLE);break;

    case 2:

    wdContext.currentContextElement().setRow2Visible(WDVsibility.VISIBLE);break;

    case 3:

    wdContext.currentContextElement().setRow3Visible(WDVsibility.VISIBLE);break;

    default:break;

    }

    Regards

    Ayyapparaj

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Ayyapparaj, I went through your code couse I have similar problem and what It seems that setting counter to 0 and applaying it as int x= wdContext.currentContextElement().getcounter();

      does not stack with further liness adds.

      It should be

      InputField InputField InputField InputField

      add

      (we press add)

      InputField InputField InputField InputField

      InputField InputField InputField InputField

      add

      (we press add again)

      InputField InputField InputField InputField

      InputField InputField InputField InputField

      InputField InputField InputField InputField

      add

      (we press add one more time and Row3 should appear under others)

      InputField InputField InputField InputField

      InputField InputField InputField InputField

      InputField InputField InputField InputField

      InputField InputField InputField InputField

      Problem is, once I, as you said

      "Create a context attribute of type int in the context.

      Ex: counter ->

      In the init initialise this to 0.

      Create three context attributes of type WDVisibility and initialise them to WDVisibility.NONE*.

      "

      in my code

      wdContext.currentContextElement().setCounter(0);

      wdContext.currentContextElement().setRow1Visible(WDVisibility.NONE);

      wdContext.currentContextElement().setRow2Visible(WDVisibility.NONE);

      wdContext.currentContextElement().setRow3Visible(WDVisibility.NONE);

      and in AddAction part

      int x = wdContext.currentContextElement().getCounter();

      switch(x)

      {

      case 1:

      wdContext.currentContextElement().setRow1Visible(WDVisibility.VISIBLE); break;

      case 2:

      wdContext.currentContextElement().setRow2Visible(WDVisibility.VISIBLE); break;

      case 3:

      wdContext.currentContextElement().setRow3Visible(WDVisibility.VISIBLE); break;

      default: break;

      }

      will not work at all (when I press add nothing appears). Once I change

      wdContext.currentContextElement().setCounter(0);

      line into

      wdContext.currentContextElement().setCounter(1); (same with 2,3)

      and press add, line Row1Visible appears (Row2 and 3 if 2 or 3 written in ()), but nothing happens when I press add again. Any Idea how to make it work as it should be?

      Edited by: Wojtek G on Jan 23, 2008 8:55 AM