Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript how can i remove the bugs here [in disabling buttons]

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #44849
    Rohithzr
    Participant

    for some reasons it did not run on codepen so created a [fiddle](http://jsfiddle.net/u3RZV/ “fiddle here”)

    their are many bugs here

    1. if the user fills both of the fields and then clears them the button is not disabled
    2. in my script i used two functions and they go like this

    • –>txt entered –> pass entered –> button enabled
    • –>pass entered –> txt entered –> button enabled

    and i believe it is a wrong way to do it

    so please help me out

    #135443
    Paulie_D
    Member

    Yeah..I’m not sure what it is you are trying to achieve.

    Some sort of proper validation would make more sense than the confusing stuff I can see here.

    #135444
    Rohithzr
    Participant

    well there is validation that is working but with one problem
    i.e. it is either displaying wrong pass error or it is confirming the sign in but not displaying empty field error
    if u can help me out in that would be nice

    https://www.dropbox.com/sh/otgy1pypltgzpsq/vYRuH2Nge3?v=0mcn

    #135446
    unasAquila
    Participant

    there is an error here.

    $(“.submit-name”).removeAttr(“disabled”);

    should be

    $(“.submit-name”).attr(“disabled”);

    #135448
    Rohithzr
    Participant

    @unasAquila well the problem prevails still (the problem is when user fills the data and then deletes it)

    #135449
    Paulie_D
    Member

    >the problem is when user fills the data and then deletes it

    Why is this a problem?

    #135450
    Rohithzr
    Participant

    i wanted that if the field(s) are empty then button is disabled if both are filled button is enabled
    but if user fills in the fields [button enabled] and then deletes the data in it then [**button is not disabled**] that is the problem!!!

    #135451
    Paulie_D
    Member

    Seems like an odd form of validation.

    Wouldn’t it make more sense to always have the button enabled but not **submit** the data if the minimum criteria isn’t met?

    Isn’t that the normal way.

    #135455
    Rohithzr
    Participant

    well actually i was using it as a bypass for my errors in login.php which are now solved (thanks to @unasAquila)

    so this question now remains for educational purposes only

    if there is a way then post it else i am marking it as solved.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.