EasyUI Forum
May 15, 2024, 09:00:15 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Actually submit forms  (Read 6068 times)
Hoffiric
Newbie
*
Posts: 5


View Profile
« on: September 28, 2015, 04:00:38 AM »

Hello

I can't seem to find a way to submit forms the normal way (you know; static POSTs). The only way I've found is by adding an actual submit input tag which then skips the whole form validation.

Asynchronous form POSTs are super annoying because they force you to soft-code the recovery path to the view instead of just having an URL for one result. It's just like infinite pages like the ones Youtube; it sucks horrible and results in the worst usability one could create with such modern tools at hand.

Please help me find a way to properly submit a form using the EasyUI validation and whatnots. The documentation does not contain a word about this, it's all about callbacks.

Thank you!
« Last Edit: September 28, 2015, 05:08:27 AM by Hoffiric » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: September 28, 2015, 08:17:01 PM »

If you wish to submit a form synchronously, call the .submit() method when validated successfully.
Code:
$('#ff').form({
onSubmit: function(){
var isValid = $(this).form('validate');
if (isValid){
this.submit();
}
return false;
}
})
Logged
Hoffiric
Newbie
*
Posts: 5


View Profile
« Reply #2 on: September 29, 2015, 02:49:24 AM »

Thanks for the code example.

I see now that I can do the validation myself, which is good.

Another issue I have found is that there seems to be no Return/Enter to submit for a form. That is mainly because EasyUI does not use an actual submit button for submitting forms, I assume. Is there a way around this or will I have to catch the return key myself and invoke the forms submit?
« Last Edit: September 29, 2015, 03:44:48 AM by Hoffiric » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: September 30, 2015, 06:08:56 PM »

You can add a hidden submit button in the form.
Code:
<form action="...">
  ...
  <input type="submit" value="submit" style="visibility:hidden">
</form>
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!