Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

265
Views
Cuando envío el botón, muestra un mensaje emergente pero también se guarda en la base de datos

// Esta es mi función de archivo js validar () {

 var z = document.forms["form1"]["sponsorid"].value; if (!z.match(/^\d+/)) { alert("Sponsor id should be in Numbers only") return false } var z2 = document.forms["form1"]["clientname"].value; if (!z2.match(/^[a-zA-Z_ ]+$/)) { alert("Client Name should be in Alphabets only") return false } var z3 = document.forms["form1"]["additionalnumber"].value; if (!z3.match(/^\d+/)) { alert("Additional Number should be in Numbers only") return false } var z4 = document.forms["form1"]["district"].value; if (!z4.match(/^[a-zA-Z_ ]+$/)) { alert("District should be in Alphabets only") return false } var z5 = document.forms["form1"]["mainownerid"].value; if (!z5.match(/^\d+/)) { alert("Main Owner ID should be in Numbers only") btnsave.Click(false) } var z6 = document.forms["form1"]["sponsorname"].value; if (!z6.match(/^[a-zA-Z_ ]+$/)) { alert("Sponsor Name should be in Alphabets only") return false } var z7 = document.forms["form1"]["mobileno"].value; if (!z7.match(/^\d+/)) { alert("Mobile Number should be in Numbers only") return false } var z8 = document.forms["form1"]["emailid"].value; if (!z8.match(/\S+@\S+\.\S+/)) { alert("Enter correct Email Id") return false } var z9 = document.forms["form1"]["phoneno"].value; if (!z9.match(/^\d+/)) { alert("Phone Number should be in Numbers only") return false } return true

}

// Este es mi archivo vb Sub protegido btnsave_Click (remitente como objeto, e como ImageClickEventArgs) Maneja btnsave.Click

 Dim con As SqlConnection = New SqlConnection(constring)

....contenido... End Sub

//Esto está en mi archivo aspx <asp:ImageButton ID="btnsave" runat="server" ImageUrl="~/images/save.gif" TabIndex="02" OnClientClick="validate()" />

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Si entiendo bien, su problema consiste en presentar un caso de validación incorrecto. Significa que no querrá enviar si la validación devuelve falso. Si es así, debe especificar el botón predeterminado de acción de envío en su formulario. Un fragmento de código para "cómo":

preste atención en defaultbutton="Button1"

 <form id="form1" runat="server" defaultbutton="Button1" <%--other code here--%> <asp:Button ID="Button1" runat="server" Text="Button" Visible="False" /> </form>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!