Click here to Skip to main content
14,172,348 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
HEllO Team,

I have the code as follows:
There are three different Controls as follows:
1.One Textbox as follows:
<td>
    <input type="text" id="topCountForQCTextbox" style="width: 90px;" />
                    </td>



2.DropDown As Follows:
<td>
                       <select id="allocateToSelect" class="combo150">
                        </select>
                   </td>


3.Label as follows
<td>
                       <label id="allocateToQCCountLabel">
                           QC Count :
                       </label>
                   </td>


My Functionality as follow :
User will select the value from DropDown and value will get display in Label.But There are Condition which I need To Perform as Follows:

First Condition.
when i am selecting the any selected value from DropDown.On that time ,In textbox ("topCountForQCTextbox") i want to set or display the value as 0(zero).

Second Condition:
Secondily, The previous value that is 0 (zero) get removed , when i am putting the value in textbox,

i have used the jquery For textbox ("topCountForQCTextbox") as follows:
function allocateQCEntity() {
            var allocateQC = cloneObject(blankQCAllocationEntity);
            
            allocateQC.TopCountForQC = $('#topCountForQCTextbox').val();

            if (allocateQC.TopCountForQC == null || allocateQC.TopCountForQC == '') {
                allocateQC.TopCountForQC == '0';
            }
            
            return allocateQC;
        }

Everything is working ,But i want to validate this Conditions.
When page load ,on textbox ("topCountForQCTextbox") no values is present ,it is blank .
when i am selecting any selected value from DropDown.On that time ,In textbox ("topCountForQCTextbox") i want to set or display the value as 0(zero).

Secondily, The previous value that is 0 (zero) get removed , when i am putting the value in textbox,

I have try this but no use
if (allocateQC.TopCountForQC == null || allocateQC.TopCountForQC == '') {
                    $('#topCountForQCTextbox').val(0);
                }

It set the value when textbox is empty,but when i put the any number that is 1 or 2 ,then also it getting the value as 0 ,which i dont want.when i put any value that is 1 ,2 3 ... so on that time textbox value get pickup not 0 (Zero).

How do i validate ???.What changes i need to make in my Code.
Please Guide me.

Kindly Assist.

Thanks
Harshal
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.190524.3 | Last Updated 11 Apr 2014
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100