W
W
wolverine7772021-04-12 17:00:04
JavaScript
wolverine777, 2021-04-12 17:00:04

How to use onBlur in Flask?

Hi, I'm trying to make my flask app work onBlur like normal javascript+html.
The task is to run the validation function when moving from one field to another.
So everything works fine:

<p >Enter an email address:</p>
<input type="text" placeholder="Type your email here..." id="myInput" onBlur="getInputValue()">
<button type="button" onclick="getInputValue();">Validate</button>

<script>
    function getInputValue(){
        
            // some function

        }
 
</script>


But if you switch to flask - it's not clear what to do:
<tr>
            <td>{{form.email.label}}</td>
            <td>{{render_field(form.email)}}</td>
            <td><button type="button" onclick="getInputValue();">check email</button></td>
        </tr>


With a button, everything works if anything, but I would like it without a button, something like this:

<td>{{render_field(form.email(onBlur_="getInputValue()"))}}</td>


and this method doesn't work - I'm "TypeError: 'Markup' object is not callable"

getting this. Can this be done in a flask at all?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
planc, 2021-04-12
@planc

https://stackoverflow.com/questions/38003712/how-t...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question