Form – Required attribute not coming when HTML content sent as email to Gmail

  c#, email, gmail, html, javascript

I am sending the following code as email in Gmail.

<form id='RejectFeedbackForm' method='get' action="http://localhost:49309/Controller/Action">
    Reason for rejection<br />
    <input type='text' name='comment' id='comment' required/><br />
    <input type='submit' value='Submit'>
</form>

But Gmail omits the required attribute. I get it like this.

<form id="m_-8883071243854624425RejectFeedbackForm" method="get" action="http://localhost:49309/Controller/Action"
    target="_blank">
    Reason for rejection<br>
    <input type="text" name="comment" id="m_-8883071243854624425comment"><br>
    <input type="submit" value="Submit">
</form>

Any idea how to achieve the required validation? I can’t use Javascript because Gmail omits that too.

Source: Ask Javascript Questions

LEAVE A COMMENT