• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

350
Views
How to finally submit a text string from an input box type=number?

How can I send the value shown in an HTML input box as '030.34' and not '0.34'? I need to prepend '03'for an ID.

I need the input box to be type 'number' so the up down buttons can be used, so I cannot set it to text.

Added: there are limits max min set on the input.

Any ideas? Thanks Chris

function ipFunction() {
  var c = SETPOINT.value;
  SETPOINT.value = xxx + c; // prepend '03' HOW???
  return true; // can be submitted 
}
<form id="frmSetPoint" name="frmSetPoint" action="#" onsubmit="ipFunction()" accept-charset="utf-8">
  <input type="number" onkeydown="return false" id="SETPOINT" name="SETPOINT" min="1" max="10">
  <input type="submit" value="Submit Value">
</form>

about 3 years ago · Santiago Gelvez
1 answers
Answer question

0

I spent a day on this - I'm just learning - but a friend put me right. Hopefully this should help others.

$("#frmSetPoint").validate({
       submitHandler: function (form) {
 var serializedData = $(form).serialize();
     serializedData = serializedData.replace("=", "='P03") + "'";

                    $.ajax({

                        url: '/value.cgi',

                        data: serializedData,

                        type: 'GET',

                        success: function (data) {                

},

  error: function (data) {
                                              
$(currentButton).prop('disabled', false);
$(currentButton).css({
color: '#ffffff',                                                                                                                                                                                                                                     
                                                                                                          
backgroundColor: '#00FF00'
});
}
});

return false;
}
}); //validate    
        
about 3 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error