Randy Tang
Randy Tang

Reputation: 4353

Google app engine with python: various ways of submitting a form

I have a form in which there are several different ways of submission:

<form action="/admin?arg1=memberManage" method="get">
  <input type="text" name="searchString" value="{{searchString}}" />
  <input type="image" name="arg2" value="search" src="search.jpg" />
  ... 
  <a name="arg2" value="orderByName" onClick="form.submit();">Order By Name</a>

  <a name="arg2" value="orderByAccount" onClick="form.submit();">Order By Account</a>

  <a name="arg2" value="orderByLastLogin" onClick="form.submit();">Order By Last Login</a>

 <!-- the followings are search results updated by AJAX -->
 <div id="searchResults">
  ...
  ...
 </div>

</form>

The form contains an image button and three links for submission. The above is just hypothetical. The idea is to submit a form with different arguments (i.e., arg2) such that the search results will be ordered differently. The search string is also retained using a template system.

Upvotes: 0

Views: 196

Answers (1)

minou
minou

Reputation: 16563

It sounds like you want three different submit buttons rather than one button and three links.

<form action="/admin?arg1=memberManage" method="get">
  <input type="text" name="searchString" value="{{searchString}}" />
  <input type="image" name="order by name" value="search1" src="search1.jpg" />
  <input type="image" name="order by account" value="search2" src="search2.jpg" />
  <input type="image" name="order by last login" value="search3" src="search3.jpg" />
  ...
</form>

On the server you then check the name of the submit button and provide the appropriate response.

Upvotes: 2

Related Questions