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

check box

hiii,

I have a jdbc query from where i get the value of a field called IS_CHARGEABLE.

The logic is , if the value is "Y", the checkbox shud b ticked, if "N",then unticked, if null, then also unticked.

In the 'checked' property of checkbox i have bound it to the value attribute ischargeable.

my code is :

while(group_rs.next())

{

is_Chargeable =group_rs.getString(1);

}

boolean ischargeable=false;

if(is_Chargeable.equalsIgnoreCase("Y"))

{

ischargeable=true;

wdComponentAPI.getMessageManager().reportSuccess("Y");

}

else if(is_Chargeable.equalsIgnoreCase("N"))

{

ischargeable=false;

}

else if(is_Chargeable.equalsIgnoreCase(null))

else

{

ischargeable=false;

}

goElement.setIsChargeable(ischargeable);

NB : group_rs--> IS the resultset

goElement-->the element of the concerned node.

But in the output i get the check-box unticked under all circumstances....Please do suggest.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 11:58 AM

    Hi,

    just make sure that is_Chargeable is not null before checking

    it into if condition add the below loop.

    before ur condition.

    if(is_Chargeable!=null)
    

    regards

    Surender Dahiya

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 10:40 AM

    Hi ,

    Check if you have binded the checked property of the check box to IsChargeable attribute.

    you can simplify your coding also .. as your logic is if the value is "Y" checked and if "N" or null unchecked

    boolean ischargeable=false;

    if(is_Chargeable.equalsIgnoreCase("Y"))

    {

    ischargeable=true;

    wdComponentAPI.getMessageManager().reportSuccess("Y");

    }

    else

    {

    ischargeable=false;

    }

    Regards,

    Sunitha Hari

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 11:55 AM

    Hi

    Just make sure that u have properly bound IsChargeable to ur

    checkbox.

    regards

    Surender Dahiya

    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.