Click here to Skip to main content
15,895,746 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionDelete consumer Pin
Member 1453057115-Jul-19 0:09
Member 1453057115-Jul-19 0:09 
AnswerRe: Delete consumer Pin
Richard MacCutchan15-Jul-19 0:42
mveRichard MacCutchan15-Jul-19 0:42 
QuestionRe: Delete consumer Pin
ZurdoDev7-Aug-19 11:08
professionalZurdoDev7-Aug-19 11:08 
QuestionLooking for Bootstrap, TypeScript,Vue and Vue Router Guide to Building a Navigation Bar Pin
Jammer29-Jun-19 2:45
Jammer29-Jun-19 2:45 
AnswerRe: Looking for Bootstrap, TypeScript,Vue and Vue Router Guide to Building a Navigation Bar Pin
Afzaal Ahmad Zeeshan30-Jul-19 5:37
professionalAfzaal Ahmad Zeeshan30-Jul-19 5:37 
Questionhow to open word file in client side Pin
Member 1447396626-Jun-19 1:32
Member 1447396626-Jun-19 1:32 
AnswerRe: how to open word file in client side Pin
Richard MacCutchan26-Jun-19 1:45
mveRichard MacCutchan26-Jun-19 1:45 
Question(SOLVED) How to activate button on mouse press? Pin
samflex6-Jun-19 4:39
samflex6-Jun-19 4:39 
Greetings again experts,

We have a requirement that when our web app loads, by default, the submit button is disabled:

Here is how I handled that:

<asp:Button runat="server" id="btnSubmit" style="width:120px;padding: 0; border: 0;background-color:#D8D8D8 !important;color: #808080; height:30px;" Text="Generate Report" OnClick="btnSubmit_Click" Enabled="false" />


Then we have six search textbox controls.

When a user enters a value of at least three characters into any of the textboxes, then the submit button is activated.

Here is the script that I am using for that:

script type="text/javascript">

//function to enable button if two textboxes contains text
function SetButtonStatus(sender, target) {
var uuid = document.getElementById('<%=suuid.ClientID %>');
var calllist = document.getElementById('<%=caller_list_id.ClientID %>');
var phone = document.getElementById('<%=phonenumber.ClientID %>');
var startdate = document.getElementById('<%=date_start.ClientID %>');
var enddate = document.getElementById('<%=date_end.ClientID %>');
var calltype = document.getElementById('<%=call_type.ClientID %>');

//Condition to check whether user enters text in a two textbox or not
if ((((((sender.value.length >= 3 || uuid.value.length >= 3) || (sender.value.length >= 3 || calllist.value.length >= 3) || (sender.value.length >= 3 || phone.value.length >= 3)  || (sender.value.length >= 3 || startdate.value.length >= 3)  || (sender.value.length >= 3 || enddate.value.length >= 3)  || (sender.value.length >= 3 || calltype.value.length >= 3))))))
document.getElementById(target).disabled = false;
else
document.getElementById(target).disabled = true;
}
</script>


On each of the six search boxes, I call this function like this (just one textbox as an example):
<asp:TextBox id="phonenumber" style="width:150px;" class="form-control" onkeyup="SetButtonStatus(this,'btnSubmit')" runat="server" />


This works good so far.

The issue we are having is that when a user enters value via mouse, then submit button is not activated.

Most users have their autoComplete on such that when a user has entered a value before, next time s/he wishes to use that value again, s/he simply double click the search textbox and selects a pull down value with his/her mouse.

In this case, the button does not get activated.

I am trying to use the following script so submit button can be activated when mouse click on any textbox is detected:

    <script type="text/javascript">
     $(document).ready(function() {
     $("input").keypress(function(e) {
      if (e.which == 254) {
       $('#btnSubmit').click();
      return false;
     }
    return true;
  });
});
</script>


It still does not work as the submit button remains disabled.

I tried keycode===13 and still no love.

Any ideas how I can resolve this?

Thanks a lo in advance

modified 6-Jun-19 12:05pm.

AnswerRe: How to activate button on mouse press? Pin
Richard Deeming6-Jun-19 5:39
mveRichard Deeming6-Jun-19 5:39 
GeneralRe: How to activate button on mouse press? Pin
samflex6-Jun-19 6:24
samflex6-Jun-19 6:24 
GeneralRe: How to activate button on mouse press? Pin
samflex6-Jun-19 7:21
samflex6-Jun-19 7:21 
GeneralRe: How to activate button on mouse press? Pin
Richard Deeming6-Jun-19 8:03
mveRichard Deeming6-Jun-19 8:03 
GeneralRe: How to activate button on mouse press? Pin
samflex6-Jun-19 9:47
samflex6-Jun-19 9:47 
Questionhow to count product codes from textarea? Pin
Veltix26-May-19 4:11
Veltix26-May-19 4:11 
AnswerRe: how to count product codes from textarea? Pin
jkirkerx27-May-19 11:14
professionaljkirkerx27-May-19 11:14 
QuestionBest ReactJS tutorial? Pin
Corey Cananza26-May-19 3:59
Corey Cananza26-May-19 3:59 
AnswerRe: Best ReactJS tutorial? Pin
Katie Webber30-Jul-19 2:06
professionalKatie Webber30-Jul-19 2:06 
AnswerRe: Best ReactJS tutorial? Pin
Harsh.Shah.ifour13-Aug-19 18:13
professionalHarsh.Shah.ifour13-Aug-19 18:13 
AnswerRe: Best ReactJS tutorial? Pin
Le centriste4-Sep-19 3:57
Le centriste4-Sep-19 3:57 
QuestionHow to call function second time? Pin
Tarun Rathore 23-May-19 19:28
Tarun Rathore 23-May-19 19:28 
GeneralRe: How to call function second time? Pin
Richard MacCutchan23-May-19 21:56
mveRichard MacCutchan23-May-19 21:56 
AnswerRe: How to call function second time? Pin
Shraddha_Patel21-Oct-19 20:04
Shraddha_Patel21-Oct-19 20:04 
QuestionExplain the working of timers in JavaScript? Also elucidate the drawbacks of using the timer, if any? Pin
Shraddha_Patel20-May-19 17:38
Shraddha_Patel20-May-19 17:38 
AnswerRe: Explain the working of timers in JavaScript? Also elucidate the drawbacks of using the timer, if any? Pin
Richard MacCutchan20-May-19 21:03
mveRichard MacCutchan20-May-19 21:03 
AnswerRe: Explain the working of timers in JavaScript? Also elucidate the drawbacks of using the timer, if any? Pin
ZurdoDev21-May-19 2:03
professionalZurdoDev21-May-19 2:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.