I have a ‘form’ that generates a url for a user via javascript. This is the HTML I have —
<form class="hidden profile-private-link-form">
<span class="link">
<input type="text" name="" value="<value>" />
</span>
</form>
However, when I try and validate the HTML it says ‘action need to be specified’. Is it fine to omit the action here, or what should I put instead?
Yes, a form must have an action, which must specify a URL to submit data too. However, inputs, textareas, etc do not have to be contained within a form. If you can’t actually submit the data (for whatever reason), then you shouldn’t be using a form to enclose it, use a division.
If you’re using AJAX or some form of JavaScript to submit data from the form, you should still specify an action as a fallback for those users who do not have JavaScript enabled.