?
Solved

Input validation during onChange results NAN

Posted on 2013-02-01
7
Medium Priority
?
538 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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

771 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