Difference between forms submitted with iUI button and Go buton

9 views
Skip to first unread message

Bill Kirtley

unread,
Jul 4, 2009, 12:59:08 AM7/4/09
to iPhoneWebDev
Hello-

I'm building an iUI application with a form that may have validation
failures requiring the user to retry.

The whole "page" has several panels that can slide in and out through
the magic of iUI, but here's the one with the form:

<div id='login' title='Login' selected=true>
<form action="/login" class="panel" id="new_session" method="post">
<h2>Log In</h2>
<div class='errorExplanation' id='errorExplanation'>
<h2>Whoops! Try again.</h2>
</div>
<fieldset class='panel'>
<div class='row'>
<label for="session_email">Email</label>
<input id="session_email" name="session[email]" size="30"
type="text" value="" />
</div>
</fieldset>
<a class='whiteButton' href='#' type='submit'>Login</a>
</form>
</div>

My problem comes when there is a validation failure and I must show
the pane again to encourage the user to try again.

If the user has tapped the button I must return (from the server) just
the login div. If the user hits the "Go" button while entering the
email, the server must return the whole html document, with all of the
other unselected divs.

I've gotten this to work by looking at the http Accept header,
returning just the div if it's '*/*', and the whole page otherwise.

It works, but it feels fragile and wrong and like I'm Doing It Wrong.

What is the correct iUI way of dealing with this issue? Should I be
doing something different in my markup? Something else I should pay
attention to server-side?

Thanks in advance for any pointers.
Reply all
Reply to author
Forward
0 new messages