PDA

View Full Version : Can put java script in a templete or does it have to reside out side the templete



Frank H. Shaw
Sat 28th Feb '09, 3:23pm
--------------- Added 1235848129 at 1235848129 ---------------
First can I put the java function in the same templete as the dropdown menu I have modifyed the calendarjump and put my java function above in the same templete.
I have the following in the php tags - Please review what i have done and tell me why this does not work.

My problem is the button shows but when the user press the "Go" button the calendar should come up one selected in the dropdown but this does not happen I do not know why this is happening and i am not so strong on the java but when in a templete it makes things even more complex understand how things work in the templete.
So is the problem in the java or is it in the templete and how to use java in the templete?


Please review the following and show me what i am doing wrong please expain and maybe show me what it should look like give me example would help.




<script type="text/javascript"> process_selected(form) {
this.form.submit();

}
</script>

<form action="calendar.php" method="get">
<div class="smallfont" style="text-align:$stylevar[left]; white-space:nowrap">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="month" value="$month" />
<input type="hidden" name="year" value="$year" />
<input type="hidden" name="do" value="$docalendar" />
<strong>$vbphrase[Lodge_Calendar]</strong><br />
<select name="c" >
<optgroup label="$vbphrase[please_select_one]">
$jumpcalendarbitsl
</optgroup>
<input type="hidden" name="me" value='2'" />
</select>
<input type="button" value="Go" onclick="process_selected(this.form)" <br />
</div>
</form>



THANKS
Frank H. Shaw


PS Once I get the java to work I plan to add a lot more to it but got to get this to work first.

Frank H. Shaw
Sat 28th Feb '09, 10:31pm
I need to tell if my java script is being called now that my leastest version of my templete i now get my selection in the dropdown to actual display the correct calendar the one selected by the user in the drop down.

Here is the working copy you can see the changes i had to make!




<script type="text/javascript"> function process_selected(this.form) {

on.form.submit();
}
</script>


<form action="calendar.php" method="get">
<div class="smallfont" style="text-align:$stylevar[left]; white-space:nowrap">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="month" value="$month" />
<input type="hidden" name="year" value="$year" />
<input type="hidden" name="do" value="$docalendar" />
<strong>$vbphrase[Lodge_Calendar]</strong><br />
<select name="c" >
<optgroup label="$vbphrase[please_select_one]">
$jumpcalendarbitsl
</optgroup>
<input type="hidden" name="me" value='2'" />
</select>
<input type="submit" class="button" value="$vbphrase[go]" onclick="process_selected(this.form)" <br />
</div>
</form>



Ok The above works but how can i debug my java script so that I know it is being called without have header output errors which would happen if i just do a echo someone must have a trick that i can use.

I could do a echo and then exit but that will not really helo if i want to keep the web page coming up and if i use the echo the web page will over write my echo?

THANKS

Frank H. Shaw

Frank H. Shaw
Sun 1st Mar '09, 11:57am
The handshaking is not happening better said is my form is not calling my java funtion can someone have a idea to get this to happening.

What i need is to be able to get my form to call my java script function before the submiting the form happens to the server.

THANKS

Frank H. Shaw