Accept all kinds of data

Asked

Viewed 62 times

0

Good afternoon,

I have this function in JS that accepts for example 1234, but I want it to also accept 12:34 (time format). I suspect that the problem is in parseint, that is, instead of parseint(txtValue...) it becomes parseString(), only I’m missing something. : S

function BtnSaveParametrizacaoTempos_Validate() {
  var erro = 0;
  var txtValueObj = $("#<%=txtValue.TextBoxClientID%>");            

  if (txtValueObj.val().trim() === ("" + parseInt(txtValueObj.val(), 10))) { 

    ITCore.Presentation.InsertValidateMsg($("#<%= txtValue.TextBoxClientID%>"), ""); 
    erro = 0; 

  } else { 

    ITCore.Presentation.InsertValidateMsg(
      $("#<%= txtValue.TextBoxClientID%>"), 
      "<%=ITCore.Common.Resources.Translate.GetTransactionString("ParametrizacaoTempos", "InvalidValue")%>"
    ); 

    erro = 1; 
  }

  ResizeIFrame();
  return erro === 0;

}

From what I’ve seen in the comics he’s got a field that’s isNumeric and NULL, so I’ll have to tell in the comics if it’s Numeric do one thing if it’s not another, right?

  • You can give examples of values you should accept and values you should not accept?

  • What should happen when the input is "12:34"? Describe your problem better and what solution you want, as Sergio commented. What do you mean, "all kinds of data"?

  • right! in this case I can accept values present in a string, example: "12234", "qwer", "12:23", "1s2dsa". When I put for example 12:34 it says invalid value, so only accepts the following "1234", "abcd" and "a1cd23" and cannot be null!!

  • So basically it just can’t be null?

  • What your code does today is to check if an integer number has been typed (which is the same type of data that your comic expects, right?) if Oce will accept any kind of data in the field now, Oce will have to change the field of your comic to accept any value

  • The bd accepts any kind of data! It is like varchar(500)! The problem is even in this function that does not let enter any kind of data.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.