?
Solved

Input validation during onChange results NAN

Posted on 2013-02-01
7
Medium Priority
?
546 Views
Last Modified: 2013-02-19
Team,
am facing an issue during my edit page where i have a text box gives me a trouble during validation.

I am calling an onchangeTotal() function , when ever there is a change in value via onchange event.  when ever there is a text entered , the total column is updated dynamically. i would like to prevent it . do all my validation after i tab out the cell.
because when there is an invalid value entered , i need to print ***** in the total section based on the value.

i have attached a screen shot where it updates the total section with Nan.

Please help.
validate.JPG
0
Comment
Question by:Easwaran Paramasivam
  • 5
  • 2
7 Comments
 
LVL 41

Expert Comment

by:guru_sami
ID: 38845559
......do all my validation after i tab out the cell.
Use onblur instead of onchange.
0
 
LVL 16

Author Comment

by:Easwaran Paramasivam
ID: 38847915
yeah. am sorry. i should have mentioned in the above query itself. yeah i tried with onblur event as well. no luck.

Thanks
0
 
LVL 41

Expert Comment

by:guru_sami
ID: 38848036
Can you share your code that didn't work...it seems some kind of type conversion issue..
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 16

Author Comment

by:Easwaran Paramasivam
ID: 38861821
Sorry for the delay.

I have added the code snippet for the input text:

input type="text" class="inputs txtr" maxLength="12" name="txt_${participant.ssn}_${plan.planId}_${contractID}_${sourceID}_${source.UIName}"                                                                                                      value="${source.contributionAmt}" id="id${contractID}_input_${sourceID}_${source.UIName}" relSrc="${sourceID}_${source.UIName}"                                                                                                 relCtr="${contractID}"  onchange="javascript:calculateTotal('${contractID}','${sourceID}','${source.UIName}')" />
                                                                                    </div>

I have uploaded the JSP page as HTML and JS script page as well.

Please do let me know if you need any additional info to dig this issue.

Thank you
EditJSP.html
EditJS.js
0
 
LVL 16

Author Comment

by:Easwaran Paramasivam
ID: 38890359
Team,
I have an validation in place to report when we enter invalid value in the text box.
various conditional check to NAN & < 0 and so on.
The point here is that when i enter the value in the text box and tab out it , validation is not occurring and when i enter value and click on any place in the web page it works and prints **** in the total section.
attached the screen print to have some details on the issue.

Can someone point out the issue with the script?.

Thanks
validation-issue.JPG
0
 
LVL 16

Accepted Solution

by:
Easwaran Paramasivam earned 0 total points
ID: 38890965
Team,
i was able to figure whats is going on in my JS function and was able to fix it.
The root cause was one of the CSS class and my existing JS file has a check

// column total
                  var columnTotal = 0;
                  $( '.rowaggregate' ).each( function()
                  {
                        columnTotal += parseFloat( $( this ).html() );
                  } );
It was very frustrating to find out this issue and happy to resolve it. Thanks a lot for this great forum.
0
 
LVL 16

Author Closing Comment

by:Easwaran Paramasivam
ID: 38904782
I was able to resolve the issue on my own. please close the question.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question