On Mon, Dec 14, 2009 at 2:02 PM, Neal <[email protected]> wrote:
> On Sun, Dec 13, 2009 at 7:31 PM, Joe Pruett <[email protected]> wrote:
>>>> i think what you want is:
>>>> Reg1: <input type="text" name="reg1" value="deadbeef"><br/>
>>>>
>>>> which makes an input box prefilled with deadbeef.
>>>>
>>>> of course with a cgi you would get the real value to put there.
>>>
>>> Yes. Exactly. Precisely. But what does _that_ look like?  It's been

In my (limited) experience with CGI, the CGI part has all boiled down
to printing out valid html to some output stream.  Some of my initial
apps just did this sort of thing:

print("<html>\n");
....
print("</html>");

Obviously, there are macros to help with all that, and frameworks that
obviate the need for extensive use of macros everywhere... but, if
we're assuming no javascript, then any dynamic content needs to be
generated with the entire page, so:

print("<input type=\"text\" name=\"reg1\" value=\"" . getReg1Value() .
"\"><br/>");

(where '.' is string concatenation)

Whatever language you're using probably has an API for generating
input fields that should be used instead of pure printing, but from my
meager understanding, that's essentially what you need to do.

After writing that out, I have suspect I've interpreted your question
wrong though....  If you need to have the field update in response to
user activity without reloading the page, then you need some form of
javascript, or you *do* need to reload the page, inserting the updated
values (faking the AJAX part).  In the later case, you'd need to pass
the parameters necessary to determine the next state in via the user's
request that is generated based on whatever action they took... eg:
say the user clicks on a button to display register 2's content.  Then
you would need to provide that information either as part of the url
or as part of the payload (eg: in a POST request).  Via url, you could
just append a query parameter to the url, eg: "?regId=2" and then use
that variable in the cgi to generate the proper output, showing the
content of register 2 instead of 1.  (Once again, there are probably
APIs to help with this too, but they will be specific to your language
and framework choice.)

Anyway, I hope I'm not off the mark :)

--Rogan



>>> way too long to recall anything about this issue so please forgive if
>>> it's absurdly obvious, but I have to skedaddle at the moment. I'll be
>>> back.  <g>
>>
>> are you asking how to write a cgi?
>
> Well, I'm asking about the value=<CGI script invocation output>
> syntax, substituting ReadReg(reg_param) for "deadbeef".
>
> <sheepish> Ok, so I've been putting off firing up the ol' search
> engine and digging back in to this issue. I've gotten on the ball and
> have apache set up for fiddling around with it now. </sheepish>
>
> Glen: Sorry old chap, I was asking about static HTML. I was working
> with an embedded 8051 with zero extra RAM so it all had to come from a
> fixed source in flash ROM. Thus the need to invoke a CGI script for
> the initial text box value.
>
> I'll get back with the answer I think I was asking when I know what it
> is. I think.
>
> NealS
> _______________________________________________
> PLUG mailing list
> [email protected]
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to