Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to use request.getParameterNames() to get my form parameters IN ORDER?  RSS feed

 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys.. i'm building an online test. I'm temporarily saving the results in a text file, but when i use
request.getParameterNames();
the parameters in a form are returned in different order.
so I get something like this:
question50 = 3
question1 = 2
question20 = 1
so I don't get my questions in order, and I wanna be able to use excel to load my text file and run macros on it.
So, how can i get something like this:
question1 = 2
question2= 1
question3=4
.
.
questionN= 5
I want my questions in order...
any ideas?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no 'inorder', the values are returned however the container sees fit.
If you have 50 questions and they are contiguous (sp?) ie all the values from 1 to 50, why not just do it yourself?

You can also include the question counter as a hidden variable so you don't hard code it.
Dave
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks mate!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!