adding an id attribute to q-input
-
Say I have the following q-input:
<q-input v-model="form.email" inverted-light color="white" stack-label="Email:" type="email" @blur="$v.form.email.$touch" :error="$v.form.email.$error"/>
I’d like to be able to make it so that if the domain of the email is
mydomain.com
that the form action will change to another website (without csrf protection) and the POST will be made to that website instead of the main one.To do this I was thinking I could use jQuery. eg.
$('#email').val().replace(/^.+@/, '') == 'mydomain.com'
then change the form action and submit.The only problem is: I don’t know how to set an
id
attribute onq-input
.Any ideas?
-
FIrstly, don’t use jQuery. Adding an Id is like adding an id to any HTML tag.
id="fooBar"
. But, since you don’t need or rather shouldn’t use jQuery, you don’t need the id.Just use plain JS to submit your form to the conditionally set URL.
Scott
-
the better use
ref
insteadid