Submit on a Dojo Form

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Submit on a Dojo Form

Harry Devine
I have a login page on one of my apps that I've always just attached an
onClick event too via a button.  But my users want, dare I say expect,
the ability to type in their password, hit Enter, and have their login
authenticated.  I tried to wrap a form around my
username/password/button controls and tried to handle the form's
"submit" function, but it never fires.  I can't figure out why.  Does
anyone have any insights on what could be happening?  I'm putting a
portion of my code below for reference.

Thanks,

Harry

Javascript:

               registry.byId("loginForm").on("submit", function(event) {
                 event.preventDefault();
                 if (this.validate()) {
                   console.log("User authenticate here...");
                 }
                 else {
                   alert("form error...");
                 }
               });

HTML:

<div data-dojo-type="dijit/form/Form" id="loginForm" action=""
method="POST">
   <div class="line-separator"></div><br>
     <div class="login_label">Name:
     <div id="loginUserName"></div></div>
   </div>
   <br><br>
   <div class="login_label"> Password:
     <input id="loginPwd" data-dojo-type="dijit/form/TextBox"
data-dojo-id="loginPwd"
data-dojo-props="type:'password',name:'loginPwd'" style="width:250px;">
   </div>
   </center>
   <br><br>
   <div class="login_button">
     <button id="btnLogin" data-dojo-id="btnLogin"
data-dojo-type="dijit/form/Button" type="submit"
name="btnLogin">Login</button>
   </div>
   <br>
</div>

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: Submit on a Dojo Form

wagner

Hi Harry,

please take a view in this...

https://jsfiddle.net/wagnermarques/4gxrsr72/28/


best regards
Reply | Threaded
Open this post in threaded view
|

Re: Submit on a Dojo Form

Harry Devine
In your example, the submit event is caught and handled.  In my code,
its not.  And I can't seem to figure out why.  What's different in your
fiddle as opposed to my original code?  What further complicates this
for me is I use the same code in another project (that's where I got it
from), and it works as designed/intended.

Thanks,

Harry

On 3/11/2017 2:58 PM, wagner wrote:

> Hi Harry,
>
> please take a view in this...
>
> https://jsfiddle.net/wagnermarques/4gxrsr72/28/
>
>
> best regards
>
>
>
> --
> View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Submit-on-a-Dojo-Form-tp4007179p4007180.html
> Sent from the Dojo Toolkit mailing list archive at Nabble.com.

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: Submit on a Dojo Form

Harry Devine
This is going to seem strange, but I fixed it.  I had a <center> tag
before the <div data-dojo-type="dijit/form/Form"> tag.  The </center>
tag was within that div.  Once I moved it outside of the </div> tag to
close the dijit/form/Form area, it works as expected.

Thanks,

Harry

On 3/11/2017 3:49 PM, Harry Devine wrote:

> In your example, the submit event is caught and handled.  In my code,
> its not.  And I can't seem to figure out why.  What's different in your
> fiddle as opposed to my original code?  What further complicates this
> for me is I use the same code in another project (that's where I got it
> from), and it works as designed/intended.
>
> Thanks,
>
> Harry
>
> On 3/11/2017 2:58 PM, wagner wrote:
>> Hi Harry,
>>
>> please take a view in this...
>>
>> https://jsfiddle.net/wagnermarques/4gxrsr72/28/
>>
>>
>> best regards
>>
>>
>>
>> --
>> View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Submit-on-a-Dojo-Form-tp4007179p4007180.html
>> Sent from the Dojo Toolkit mailing list archive at Nabble.com.

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|

Re: Submit on a Dojo Form

wagner
great... :)

Wagner França Marques
954731643 
967256050

2017-03-12 0:08 GMT-03:00 Harry Devine <[hidden email]>:
This is going to seem strange, but I fixed it.  I had a <center> tag
before the <div data-dojo-type="dijit/form/Form"> tag.  The </center>
tag was within that div.  Once I moved it outside of the </div> tag to
close the dijit/form/Form area, it works as expected.

Thanks,

Harry

On 3/11/2017 3:49 PM, Harry Devine wrote:
> In your example, the submit event is caught and handled.  In my code,
> its not.  And I can't seem to figure out why.  What's different in your
> fiddle as opposed to my original code?  What further complicates this
> for me is I use the same code in another project (that's where I got it
> from), and it works as designed/intended.
>
> Thanks,
>
> Harry
>
> On 3/11/2017 2:58 PM, wagner wrote:
>> Hi Harry,
>>
>> please take a view in this...
>>
>> https://jsfiddle.net/wagnermarques/4gxrsr72/28/
>>
>>
>> best regards
>>
>>
>>
>> --
>> View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Submit-on-a-Dojo-Form-tp4007179p4007180.html
>> Sent from the Dojo Toolkit mailing list archive at Nabble.com.

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest


--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest