Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: obtaining yyyy-mm-dd via a calendar object

by Asim (Hermit)
on Jul 31, 2006 at 14:45 UTC ( [id://564755]=note: print w/replies, xml ) Need Help??


in reply to Re^3: obtaining yyyy-mm-dd via a calendar object
in thread obtaining yyyy-mm-dd via a calendar object

I'd rather be able to keep the javascript separate if there is a way to do so...

You can always generate it as a separate file, and link it into your HTML. Also, Perl has a number of Templating modules, such as HTML::Template and Template Toolkit, which are designed to cleanly pull the HTML (and, by extension, Javascript embedded in HTML and/or "pure" Javascript files) formatting out of your Perl code.

*EDIT because I forgot to put this back in* To reference the answer from the Javascript in the HTML you're creating, you'll need, ironically, to set the Value of the textfield to equal the value of the Javascript -- although there are other ways, this might be the cleanest. You would do something like document.getElementById("response1”).value = "text_of_answer" to set it, and you can put it where you need to within the Javascript itself.

Having said that...if you're unfamiliar with Javascript, you're likely best to do some research and testing with static files containing HTML and Javascript, and then come back to implementing CGI. Even if your values are from CGI forms, you can just use a test variable and roll with it.

You're trying to cover a LOT of newtech in one go, and I think, from reading your past writeups, this might be causing you frustration. Take one chuck of tech (HTML, Javascript, Perl, etc.) at a time, play with them, and you should find great success!

*Another minute, another EDIT...* Try the new Mozilla Javascript site -- it's basically the replacement for the site in the CGI docs you found was dead.

Goes off to check into making a small patch to the CGI.pm docs...

----Asim, known to some as Woodrow.

Replies are listed 'Best First'.
Re^5: obtaining yyyy-mm-dd via a calendar object
by gmacfadden (Sexton) on Aug 03, 2006 at 20:53 UTC
    Thanks for your suggestions (and everyone else's helpfulness) - they offered several teachable experiences in better understanding HTML, javascript, and GCI.
    When i read in the CPAN CGI documentation that the javascript action button will probably not even display on non-netscapre browsers, i realized it was time to quit and plan another way to attack my problem.
    I came across a great website for example code, www.krugle.com. Their section on GIMP Toolkit (GTK), using perl seems pretty extensive. Before i spend the same amount of time digging down into GTK calendar widgets and the like, would welcome other's opinion as to the usefulness of this site, and any suggestions as to my long ago simple goal (from perl, to click on an calendar object to select a date, and fill in a form variable with the selected date).
    net-net, will i be on a fruitful path if i go done the TDK calendar widget route?

      To start: GTK code won't work via CGI*, if I understand your comments correctly. If you're trying to use GTK over the Web in any way, um, don't. :)

      Action button: Again -- just don't use it. Really. I don't know what code you have that uses it, but I've never come across any Javascript that uses this "Action Button". Instead, use a link with an "OnClick", or the HTML button with same. And, of course, this is drifting somewhat off-topic...

      I think you're looking for an Optimal Solution, yes? In the HTML/Javascript world, there really isn't one, esp. for interface design. You're always going to be learning more, and working through trade-offs and OS limitations and Web server quirks and programming language barriers.

      If you're still trying to work out the basics of these technologies, and how they interact, I recommend more reading -- not about APIs and end solutions, but about the nuts and bolts of HTTP, HTML, Javascript, CGI, and how they all interact. You'll need some good books, really, to make it all work together in your mind; the Internet doesn't have a lot of great "deep" material on it. And when you do? A lot of this frustration you have will be lifted.

      Does that make sense?







      * OK, pedantically, I'm sure you could do some sort of RPC call. But you really don't want to go there at all.

      ----Asim, known to some as Woodrow.

        Asim,
        i appreciate the patience and helpfulness you have accorded someone with more questions than knowledge(i.e., me).
        In the past the tone and ego-erudition of some of others meaning to be helpful has been discouraging me...thank you for being an honest broker and for being a breath of fresh air. you are a great coach (i know because i am one (girls lacrosse is my heart job).... you get my award for most 'novice' friendly thus far...much thanks

        the great thing is this is all like one great big soduko, if nothing else it's going to keep me mentally sharp as i age
        does php allow you the same flexibility as perl? i see courses in the adult ed for php, but nothing on perl

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://564755]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-03-29 10:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found