• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
  • Frits Walraven
  • fred rosenberger
  • salvin francis

Making Two different function run on same element but for different events.

Posts: 19
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here i am having a html page

I want to run two validation check on some of the fields like for username email.
I want to check their uniqueness (availability) from server using .ajax() and also to validate them if the field is empty or the entered data is not acceptable like(email: foo@hu).
What i have done is seprated the two checks as follows :
the ajax uniqueness (availability) check is set for the keyup event ;
and the validation check of required field is due till the submit.
Pretty much accomplished the above two thing except the preventDefault action of the submit button if the span errors are present due to "ajax" check.
here is my js

here in the above code the check for if any error before submission has a condition

which i included to check for the error of unique class generated due to the ajax calls.
but what i do is if the username is available i place a checkmark and "Available" message displayed which though is not a error but prevent my form submission .

So my questions are:
1.i want to know how can i allow submit if the error is due to the checkmark "available".?
2.Rather than checking for validation after submit, how can i accomplish it after the event blur from that field.means doing the two checks simultaneously on input field.
3.i have copied the same code thrice in the script for ajax checking uniqueness for three fields.Can i combine them into one?.or am i asking too much because the message displayed is different every time.
4.ajaxCompletet is not responding that's why i commented it out.Also after doin that my code is working the only problem the firebug console shows in the XML field is "Parsing error syntax location"what is that.?

Sorry for such a long post but after lots of lots of googling i end up finally asking here.
Thanks for patience
Vivek K Jain
Posts: 19
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
all problems solved..
sometimes the solution is within we just need motivation to solve it by our self, thanks for that motivation
    Bookmark Topic Watch Topic
  • New Topic