Multiple form

23 views
Skip to first unread message

Paul Hooker

unread,
Apr 1, 2014, 10:24:42 AM4/1/14
to iphone...@googlegroups.com
Hello,
  I have created a iUI webapp which uses a series of HTML forms.

  I have found a problem.

  If I navigate to a HTML form, but don't submit instead go backwards... When I navigate to another form I can not submit that form.

  I have given each form a unique ID and Name, so the javascript submit is different in each case.  However, backing out of a form removes the ability to submit any other form.

  Is this a known bug?  How do I fix it?

Thanks!

Jeff

unread,
Apr 2, 2014, 10:37:19 AM4/2/14
to iphone...@googlegroups.com
I have apps with multiple forms and have never had that issue. I'm no Guru, but it seems to me that this is functionally no different than having multiple forms on a single web page, only one is displayed at a time. Are your forms dynamically created? First place I'd look, which you probably have but I'll mention it anyway, is at the source HTML created by your code and ensure nothing is missing structurally.

As is usual, posting a link to example code would assist in someone being able to help you out.

If you find the issue on your own, please be sure to post back and let us know. :-)

Remi Grumeau

unread,
Apr 13, 2014, 9:08:36 AM4/13/14
to iphone...@googlegroups.com
Hi Paul,

If you look at the iui.js file itself, line 577, you can see how iUI deals with form.
Onclick, it checks if the button or link has an attribute "type" equals to "submit". If so, it gets the closest <form> element in parent nodes.
Which means the submit button has to be between <form> & </form> + needs to have a type="submit" (you can put this on a input, button or link).
Then it looks if the form has a target="_self" and use the onsubmit attribute to do the job. If onsubmit is not set, then a regular form.submit() is triggered.

That's how forms are taken in account in iUI.
But all of this is done only when you click on the submit button.

If the form element has a target="_self", there is submit event by default on all <form>. iui.js, line 660.
What it does is adding a classname "progress" on the form element, using its "action" value to trigger iui.showPageByHref() (in this case, it returns the "action" url output in the DOM and navigates to it).

So perhaps there is something wrong with the "action" value or with the format / content of form outputs.

Remi
Reply all
Reply to author
Forward
0 new messages