![]() |
|
laziness, impatience, and hubris | |
PerlMonks |
Re: How to make a friendly UIby thpfft (Chaplain) |
on May 03, 2001 at 18:19 UTC ( #77657=note: print w/replies, xml ) | Need Help?? |
You have two options, i think. 1. dump data from your script into javascript variables and include javascript code on the page itself that will select from it to update the value of some boxes when other boxes are changed. You get this sometimes on very structured sites where lots of subcategorisation is required. there are no server-side processes after the initial page-building step. You tend to get large pages this way, because of all the permutations that need to be considered, and you'll need a reasonable command of javascript. 2. make repeated cgi calls. if you want to get data from the server based on user input, you have to go through the usual 'send data, receive data' process, and that means you have to refresh the page. If you wanted things to unfold in friendly way then you could do something with frames or pop-up windows, but you face the prospect of building and debugging a system with interdependent javascript, perl and frame targetting. ugly. Two other considerations i'd like to mention. Firstly, neither of these approaches will work well without strictly controlled and relatively simple input. perhaps you were just glossing over the details, but this sort of thing will only work reliably with drop-down lists or checkboxes (ie, fields where the values are defined in advance) rather than text fields or textboxes, where typos abound. They also offer onClick or onSelect methods (?terminology?) that are more reliable than onChange, which rather unhelpfully requires you to tab _out_ of the field to trigger the script. Secondly, what's wrong with refreshing the page? i can see cases where you want to let people choose subcategories on a complex form without hassle, but if the form is that complicated, are you sure you wouldn't be better off building a simpler one? Given that the goal is friendliness, you'll get better results from clear language and consistent behaviour than from gui cleverness. imho.
In Section
Seekers of Perl Wisdom
|
|