Solved

Input validation during onChange results NAN

Posted on 2013-02-01
7
534 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

726 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