View Full Version : to beetle, responding to symptons not problem.

Uncle Ron
01-10-2003, 06:20 PM
First, let me ask you, how do I keep this thread going? I seem to fall out of it when I try to respond to your suggestions.

Second, you may be right. But this is how I see it (I'm an old timer with experience in COBOL and a wonderful database system called PICK, so I'm trying my hardest to change my ways.)

When the script is requested all values are null. When the onChange is executed all three of the submit buttons are still null. I need a way to make update2 something other than null, like '1', for instance.

Then when the form is submitted, update1 will be null, update2 will be 1 and exit will be null. That way the PERL script will "know" that a request to retreive a group from the database has been submitted.

In the main script (masterFiles.cgi) the update codes are processed as follows: when update1 = 1, the script updates the data base, when update2 = 1 then the script retrieves the requested member of the data base and when exit = 1 then the script exits to the menuMaster.cgi (usually).

If my thinking is not too muddled, I think I need a function that will, onChange, set update2=1 and then submit the form.

Thanks in advance for hanging in there with me. I really appreciate your time and effort.

UR :confused:

01-10-2003, 06:32 PM
Please bear in mind that lots of people look at this. I'm looking at it now, and have no idea what you're talking about.

Can you give some context - what original thread are you referring to?

Uncle Ron
01-10-2003, 06:38 PM
original thread was 12621, then another was started and it was 12699.
Thanks for looking


01-10-2003, 06:47 PM
Hey Ron, just FYI, you don't need to make multiple posts. I keep track of each post I don't respond to with my email at the house. If I don't get back to you within a day it's because, well, I'm busy.

Moving along...since you'd like to submit the form based on the changing of a SELECT, it would be important that the OPTIONs contain the data we need. What do the options look like?

01-10-2003, 06:51 PM
and why create a new thread, adressed to a particular user? why don't follow the original threads? :confused:

Uncle Ron
01-10-2003, 07:41 PM
Thank-you one and all. I know I'm confusing everyone, but it's just a symptom of my own confusion. Please accept my apologies. I really do appreciate the help and I'll try to be better about sticking with one thread.

OK, to answer beetle, here is the <SELECT> with <OPTION>, keep in mind that EVERY page served from this site is dynamically generated with PERL. The script finds the right database and loads a hash that is used as the <OPTION> parameters.

like so:

<FORM method="post" action="https://$base/$root/$program?mstrinput=$mstrinput">
<TR><TD class=md align=right width=50%>Select a Group:&nbsp;
<TD><SELECT name=group onChange="this.form.submit()">
$dir = "$path/$pwid/groups";
foreach $group(sort keys %groups)

The {print"<OPTION>$group";} correctly places the GROUP's and the onChange="this.form.submit()" really does submit the correct group name.

Unfortunately the <FORM> has three submit buttons. When you actually 'click' on a button, that button is initialized and it's value passed to the script. The other two buttons either remain null or are not passed at all (I'm not sure which is the case.) In either case, I'd like the onChange to initialize update2 button to 1.

I have found that variables within the <INPUT> tag are only included in the submission of a form when they are EXPLICITLY selected or clicked. I'm just thinking, can JavaScript really change a variable that is within a <INPUT> tag, or do I need to add the proper variable as part of the <OPTION> tag. Sort of like this:

<OPTION value=$update2|$group>$group ??


Uncle Ron
01-10-2003, 08:28 PM
Thank-you all, especially beetle.

The onChange is doing what I need it to do. I tried the idea I had in my last message. It works just fine. In fact it works GREAT.

I'd still be interested in knowing if JavaScript is capable of initializing a variable that belongs to a <INPUT type=submit> tag.

My solution, suggested by beetle that the <OPTION> needed to have all the information makes me think that the onChange only submits the form and doesn't submit anything within the <INPUT type=submit> tag, but I'm not really sure that's true.

Again thank-you all for your help. I'ts been a lot of fun.

:) :) :)
a very happy Uncle Ron

01-10-2003, 09:39 PM
Well, this could be done.
<script type="text/javascript">
function doSubmit( elem )
var f = this.form;
var o = this.options[this.selectedIndex];
var values = o.value.split('|');
o.value = values[0];
f.elements[values[1]].value = values[2];

<select onchange="doSubmit( this );">
<option value="group1|update2|1">Group 1</option>
<!-- other options -->
</select>This function does three things

1) Populates 'update2' with a value of '1'
2) Populates the selected option with a value of 'group1'
3) submits the form

Are we getting warm?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum