473,804 Members | 3,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP PRINT statement with OnChange event

I have tried every variation of the "onchange" statement below without
any actual reloading of the page. I am hoping that the PHP PRINT
statement is constructed wrong, otherwise it is javaScript error an
needs to be posted in the javaScript newsgroup.

The FireFox javaScript Console reports the following message:

Error: missing : in conditional expression
Source Code:
location.href=t hemes.php?schem e=(form.color_s chemes.options[form.color_sche mes.selectedInd ex].value)

My Code for the dropdown box is:
<form name='color_sch emes' method='post' action='themes. php' >
Select a scheme:&nbsp;

<?php
print "<select name='scheme' size='1'
onchange='locat ion.href=themes .php?scheme=(fo rm.color_scheme s.options[form.color_sche mes.selectedInd ex].value)'>\n";

//populate the dropdown selector box...
$counter = 1;

foreach ($schemes as $scheme)
{
if ($selected_them e == $counter)
print "<option value = '$counter' selected>$schem e</option>\n";
else
{
print "<option value = '$counter'>$sch eme</option>\n";
}
$counter ++;
}

?>

I would appreciate any advice...its probably something that is very
trivial and a very glaring defect, but I am blind to it.

Thanks,

Miki
Jul 17 '05 #1
1 5171
> Error: missing : in conditional expression
Source Code:
location.href=t hemes.php?schem e=(form.color_s chemes.options[form.color_sche mes.selectedInd ex].value)

Your error is on that line, and it's javascript. You've not put quotes
around the URL you want to reload
try this:
location.href=' themes.php?sche me='+(form.colo r_schemes.optio ns[form.color_sche mes.selectedInd ex].value)

Michelle wrote: I have tried every variation of the "onchange" statement below without
any actual reloading of the page. I am hoping that the PHP PRINT
statement is constructed wrong, otherwise it is javaScript error an
needs to be posted in the javaScript newsgroup.

The FireFox javaScript Console reports the following message:

Error: missing : in conditional expression
Source Code:
location.href=t hemes.php?schem e=(form.color_s chemes.options[form.color_sche mes.selectedInd ex].value)
My Code for the dropdown box is:
<form name='color_sch emes' method='post' action='themes. php' >
Select a scheme:&nbsp;

<?php
print "<select name='scheme' size='1'
onchange='locat ion.href=themes .php?scheme=(fo rm.color_scheme s.options[form.color_sche mes.selectedInd ex].value)'>\n";
//populate the dropdown selector box...
$counter = 1;

foreach ($schemes as $scheme)
{
if ($selected_them e == $counter)
print "<option value = '$counter' selected>$schem e</option>\n";
else
{
print "<option value = '$counter'>$sch eme</option>\n";
}
$counter ++;
}

?>

I would appreciate any advice...its probably something that is very
trivial and a very glaring defect, but I am blind to it.

Thanks,

Miki

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
20705
by: Covad | last post by:
Hi all, For some reason my change() function is only called when the page loads. I'd much rather it gets called when the select changes. Here's the code: window.onload = init; function init() {
2
1760
by: F. Da Costa | last post by:
Hi, I'm trying to call/ mimic an onchange function/ event after a user has clicked a checkbox. In response to which a buncch of other ones need to be checked as well. The caveat is that each of those child-checkboxes need to have an onchange action take place. All of these child-boxes *have* got a working onchange eventListener attached (thx to an old post of Lasse Reichstein Nielsen). Following a snip that suggests (or so the...
2
12173
by: Asit | last post by:
In JavaScripts checks for an onChange event against the value of the textbox at the time of the last onChange event. Since an onChange Event never fired after you changed the text first time , suppose we put the same value in the text box then no event is fired. If we put some other value then it became fired... It wouldn't fire if we put the same value... I don't want to use onBlur etc... Isthere any solution with onChange Event...?
13
31486
by: aundro | last post by:
Hello, I've been looking on the web for a solution to this problem: I create a set of checkboxes, and 2 buttons: - one is labeled "All" - the other is labeled "None" Clicking "All" is supposed to check all the checkboxes, which it does (that's not rocket science ;), but the 'onchange' event does not get triggered.
4
4091
by: Zeebra3 | last post by:
Here goes: I have a web form with several asp:dropdownlists, with which, when selection is changed I want to fire an event defined in some clientside js. The content of the clientside code is dependant on data collected in the code behind on the server. I have set AutoPostback to false for the controls and added lines such as cboMyCombo1.Attributes.Add("onchange", "MyCombos_OnChange('1')"); in the Page_Load event, which is rendered OK...
3
3989
by: jab3 | last post by:
Hello. I"m new to this group, and to JavaScript in general, so please forgive me if I breach local etiquette. I'm trying to implement some client-side 'dynamic' validation on a form. I'm having a couple of problems, which I'll try to describe. But this e-mail will only reproduce one of them, in a "short" example. What I'm generally doing is having each form entry contained in a div, which as a label, an input with some event handlers,...
4
47983
by: auslandt | last post by:
I have an HTML file that includes a JavaScript. I would like this JavaScript to be able to create an "onChange=<function>" attribute against the password element. Here is an example page of the onChange embedded in the "password" field. This is normal HTML and it works fine. <HTML> <HEAD><TITLE> Example of onChange Event Handler </TITLE> </HEAD> <BODY BGCOLOR="FFFFFF" TEXT="000000"> <H3>Example of onChange Event Handler</H3> <form...
21
29835
by: Leena P | last post by:
i want to basically take some information for the product and let the user enter the the material required to make this product 1.first page test.php which takes product code and displays prodcut anme have used ajax to avoid refreshing of page this works fine 2.now i have created one row with checkbox|select box|text|text|text|text| where in the select box values are fetched from table here also i have used ajax for getting the m_name...
0
9582
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10580
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9157
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2993
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.