javascript - Regex for a checkbox to send a form -


I am trying to create a form with a checkbox which only checks the check box (when the dog is a Collar). If the dog does not have a caller (unconscious box) then this message displays: "Your dog needs a collar."

I think I need a bracket, quote, or the surrounding colonel (code 5 line)?

The form currently works, but it does not distinguish between a check box or an untact box.

  & lt; Script type = "text / javascript" & gt; Function hgsubmit () {if (/sS+/.test(document.hgmailer.name.value) == false) Warning ("Please provide your name."); Else if (/[havecollar]/.test(document.hgmailer.collar.value) == incorrect) Warning ("Your dog needs to ride a collar."); Else {document.hgmailer.submit (); Warning ('Thank you! \ N your email has been sent'.); }} & lt; / Script & gt; & Lt; Form action = "http://www.example.com/cgi-sys/formmail.pl" method = "post" name = "hgmailer" id = "hgmailer" & gt; & Lt; Input type = "hidden" name = "recipient" value = "we [email deleted] .com" /> & Lt; Input type = "hidden" name = "topic" value = "form mail e-mail (prospect dog)" / & gt; & Lt; Table range = "0" cells = "0" cellpadding = "0" & ​​gt; & Lt; TR & gt; & Lt; Td> Your name & lt; sup style = "color: # F00" & gt; * & Lt; / sup>: & lt; / Td> & Lt; TD & gt; & Lt; Input type = "text" name = "name" value = "" /> & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> My dog ​​will be wearing a collar with an attachment point for leadership. & Lt; / Td> & Lt; Td> & Lt; Input type = "checkbox" name = "collar" value = "halaler" & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt; & Lt; Input type = "button" value = "send email" onclick = "hgsubmit ();" / & Gt; & Lt; Input type = "hidden" name = "redirect" value = "http://example.com/test.htm" /> & Lt; / Form & gt; No need for regex; Just give an ID to your checkbox element such as the hackler.  

document.getElementById ('hascollar')

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -