Skip to Content
author's profile photo
Former Member

Cursor should come to that filed, if user deosn't enters it

Hi Team,

I want to make the cursor should placed on that perticular place, when the user doesn't enter any value for that field.

I wrote the below code, It showing the inputfiled as red, but the cursor is not coming to that field.

String firstName = wdContext.currentContextElement().getFirstName();

if(firstName == null){

wdComponentAPI.getMessageManager().reportContextAttributeMessage(

wdContext.currentContextElement(),

wdContext.getNodeInfo().getAttribute("firstName"),IMessageBalaComp.FIRST_NAME_BLANK,null,false);

Can any help me on this.

Regards,

Bala

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Sep 03, 2008 at 10:28 AM

    Hi Bala pls find the code

    You want ot set the focus to ur input element right? For this create a global static boolean flag;

    and the onAction of your button

    String name = wdContext.currentContextElement().getFirstName();

    if (name==null) {

    flag = true;

    } else {

    flag = false;

    }

    and then write following code in wdDoModify....

    if (flag) {

    IWDInputField dri =

    (IWDDropDownByIndex) view.getElement("<index of input field>");

    dri.requestFocus();

    flag = false;

    }

    Please go through this thread

    focus-on-ui-element

    Regards

    Kalyan

    Edited by: venkatakalyan karanam on Sep 3, 2008 12:29 PM

    Add comment
    10|10000 characters needed characters exceeded