Forum Moderators: coopster & phranque

Message Too Old, No Replies

Html page that expands

Using perl, and html

         

Drewser

3:29 pm on Jun 12, 2003 (gmt 0)

10+ Year Member



Hello to the Perl Scripting Community.

I am pretty new at this whole scripting thing, and I was wondering if someone would kind enough to help on this problem.

I want to be able to have an html page that expands when you push a button (has some data, then when you push the button, displays more web data below the data already there). My thoughts on this was to have a perl variable controlling an 'if' loop that would start more html code for the second part. I used a javascript to try and change the perl variable, but I'm not sure I can change the perl variable in my javascript, thus even when clicking the button, the second part doesn't appear.

JavaScript:
function addstuff(){
$change="true";
}

Calling the Script:
<input type=button value="Add second part" onClick="addstuff()">

Second Part:
if(change eq "true"){
print <<EndHTML;
<html>
<body>
SUCCESS! You are a genius!
</body>
</html>
EndHTML

(Simplified)

What can I do?

Thanks in advance,
Drewser

waldemar

4:00 pm on Jun 12, 2003 (gmt 0)

10+ Year Member



Hello Drewser and welcome.

If showing (& hiding) content in a single html page is the only thing you want to do you may put too much effort into using perl for that purpose.

Maybe you want to check out this thread [webmasterworld.com...] to learn how it can be done easier on the client/webbrowser's side using Javascript and CSS.

regards
waldemar

Drewser

4:06 pm on Jun 12, 2003 (gmt 0)

10+ Year Member



Thanks for the link, it looks to be very helpful. I'm going to play with the code and see if I can get it.

I still need the perl backing because I am collecting data I recieve from a form and sending it to another perl script to process it.

Drewser

4:31 pm on Jun 12, 2003 (gmt 0)

10+ Year Member



Is there an easier way? The people who will see this page will have almost any kind of browser. It seems like a hassle to have to account for each one.

jaski

5:36 pm on Jun 12, 2003 (gmt 0)

10+ Year Member



Hi Drewser,
Welcome to the Webmaster World.

I want to be able to have an html page that expands when you push a button.

Just a bit of clarification there .. what do you mean by "expands" .. do you mean to say that when you click a button .. it should submit some data back to the server .. and bring new content on the page?

Drewser

7:03 pm on Jun 12, 2003 (gmt 0)

10+ Year Member



Expanding here means that I don't want to submit any data to the server yet, just bring up extra fields to fill in. This is because in this form, you only have to fill out the bottom of it if certain conditions are met.

I know it would be easier to make it a separate form or have it all on one page with user filling out what is necessary, but my team wants this specific feature of hiding part of the form until the user really needs it.

DrDoc

8:37 pm on Jun 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's actually not that hard to make it work cross-browser using JavaScript and CSS (well, unless a large chunk of your visitors are using pre-v5 browsers)

jaski

4:53 am on Jun 13, 2003 (gmt 0)

10+ Year Member



Expanding here means that I don't want to submit any data to the server yet, just bring up extra fields to fill in.

Perl comes into play only on the server side. What you are trying to do is purely on the client side .. so perl has nothing to do with that.

As DrDoc has suggested JavaScript and CSS can be used to hide/show stuff on client side.

Drewser

12:59 pm on Jun 13, 2003 (gmt 0)

10+ Year Member



Playing around with the layers, I realized that Netscape 4.7 doesn't support all the capabilites needed to hide the data because the form data fields don't appear in the other layers.

As for perl, I vaguely remember some way of using the CGI.pm module to do something similiar to what I need, but am having trouble getting started.