Skip to content

Instantly share code, notes, and snippets.

@troscoe
Created April 29, 2013 19:55
Show Gist options
  • Save troscoe/5484261 to your computer and use it in GitHub Desktop.
Save troscoe/5484261 to your computer and use it in GitHub Desktop.
<ListView id="login_table_view" class="table">
<Templates>
<ItemTemplate name="email_template">
<TextField id="email" hintText="Email" onFocus="handleFocus" onBlur="handleBlur" onReturn="focusPassword" onChange="checkTextField" />
</ItemTemplate>
<ItemTemplate name="password_template">
<TextField id="password" hintText="Password" passwordMask="true" onFocus="handleFocus" onBlur="handleBlur" onReturn="attemptLogin" onChange="checkTextField" />
</ItemTemplate>
</Templates>
<ListSection>
<ListItem id="email_row" class="table_row" template="email_template" />
<ListItem id="password_row" class="table_row" template="password_template" />
</ListSection>
</ListView>
@troscoe
Copy link
Author

troscoe commented Apr 29, 2013

Trying to remove focus from email or password Text Fields when user taps outside of them but can't target the Text Fields via id from the controller. i.e. $.email.blur();

@FokkeZB
Copy link

FokkeZB commented May 2, 2013

That's because $ refers to the listview.js controller and since the template is repeated for every item in the list, it cannot refer to it.

Just take a look at the generated code in the Resources folder and see if there is a way to get to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment