Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: 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 reply to Re: How to make a friendly UI by thpfft
in thread How to make a friendly UI by daveh71

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-25 22:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found