473,405 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Select variable

GTi
Whats wring with this code?

<select class=EditField size="1" name="PlantUnitID" title="Select
line">
<option value="0" >Standalone Unit</option>
<option value="1" selected >Connected Unit 1</option>
<option value="1" selected >Connected Unit 2</option>
</select>
<span
onclick="NewWindow('pluginpage.html?EditUnitGUID=' +this.form.PlantUnitID.options[this.form.PlantUnitID.selectedIndex].value+'&DoPostBack=1','namexx',200,310);"
style="cursor:pointer;">
<img border="0" src="./images/FolderOpen.gif" alt="[]" /></span>

I want to pass the selected ID to a new window as part of a parameter.

Jan 10 '06 #1
5 2157
GTi wrote:
Whats wring with this code?

<select class=EditField size="1" name="PlantUnitID" title="Select ^^^^^^^^^ line">
<option value="0" >Standalone Unit</option>
<option value="1" selected >Connected Unit 1</option>
<option value="1" selected >Connected Unit 2</option>
Should that not be value="2"? And more than one selected option is
only allowed/possible with multiple selects, that are `select' elements
with the `multiple' attribute.

[word-wrapped code to be better legible] </select>
<span
onclick="NewWindow('pluginpage.html?EditUnitGUID='
+this.form.PlantUnitID.options[this.form.PlantUnitID.selectedIndex].value
+'&DoPostBack=1','namexx',200,310);"
style="cursor:pointer;">
You are abusing an element as a control that is intended to mark up
inline sections of text.
<img border="0" src="./images/FolderOpen.gif" alt="[]" /></span> ^
Either you are misusing XML syntax in HTML, which is a direct _SGML_
application, or you are serving not well-formed XHTML above, since in
XML applications like XHTML all attribute values must be quoted or
double-quoted.

As your code style suggests that you lack the required minimum clue,
most certainly the former applies.
I want to pass the selected ID to a new window as part of a parameter.


`span' elements are not form controls and so the respective element
objects do not have a `form' property even if they are descendants
of a `form' element.

Your form's data cannot be submitted by users which UA lacks client-side
script support or has it disabled. You should reconsider your approach
and use something more like

<form action="pluginpage.html?DoPostBack=1" target="namexx"
onsubmit="window.open('', 'namexx', 200, 310);">
<select name="EditUnitGUID" size="1" multiple title="Select line"
class="EditField">
<option value="0">Standalone Unit</option>
<option value="1" selected>Connected Unit 1</option>
<option value="2" selected>Connected Unit 2</option>
</select>
<input type="image" border="0" src="images/FolderOpen.gif" alt="Submit">
<form>

Note that trying to force users to use windows of a certain size that
may not even fit their needs regarding font size etc. introduces a
usability issue that should be weighed carefully before.
PointedEars
Jan 10 '06 #2
GTi
Thomas 'PointedEars' Lahn wrote:
GTi wrote:
Whats wring with this code?

<select class=EditField size="1" name="PlantUnitID" title="Select ^^^^^^^^^
line">
<option value="0" >Standalone Unit</option>
<option value="1" selected >Connected Unit 1</option>
<option value="1" selected >Connected Unit 2</option>


Should that not be value="2"? And more than one selected option is
only allowed/possible with multiple selects, that are `select' elements
with the `multiple' attribute.

My mistake, used cut&paste since the original values was cryptic for
this.
And yes - only ONE select.

[word-wrapped code to be better legible]
</select>
<span
onclick="NewWindow('pluginpage.html?EditUnitGUID='
+this.form.PlantUnitID.options[this.form.PlantUnitID.selectedIndex].value
+'&DoPostBack=1','namexx',200,310);"
style="cursor:pointer;">
You are abusing an element as a control that is intended to mark up
inline sections of text.
<img border="0" src="./images/FolderOpen.gif" alt="[]" /></span>

^
Either you are misusing XML syntax in HTML, which is a direct _SGML_
application, or you are serving not well-formed XHTML above, since in
XML applications like XHTML all attribute values must be quoted or
double-quoted.

Okidoki but my HTML/XHTML Validator (FireFox) says it should be like
so.


As your code style suggests that you lack the required minimum clue,
most certainly the former applies.
I want to pass the selected ID to a new window as part of a parameter.
`span' elements are not form controls and so the respective element
objects do not have a `form' property even if they are descendants
of a `form' element.

Your form's data cannot be submitted by users which UA lacks client-side
script support or has it disabled. You should reconsider your approach
and use something more like

<form action="pluginpage.html?DoPostBack=1" target="namexx"
onsubmit="window.open('', 'namexx', 200, 310);">
<select name="EditUnitGUID" size="1" multiple title="Select line"
class="EditField">
<option value="0">Standalone Unit</option>
<option value="1" selected>Connected Unit 1</option>
<option value="2" selected>Connected Unit 2</option>
</select>
<input type="image" border="0" src="images/FolderOpen.gif" alt="Submit">
<form>


I think you misunderstand - My submit button is placed on another place
on this page and it realy don't mather on this question.
This popup window is only a property window of the _selected_ item in
the combobox. The form is NOT submitted to this popupwindow. So passing
the value on the selected item to this popup window will then show
proprties of the item (and the user may change name etc. thats is the
posted back to the form - but that is not part of this question).
AND it is a webapplication for a intranet site.


Note that trying to force users to use windows of a certain size that
may not even fit their needs regarding font size etc. introduces a
usability issue that should be weighed carefully before.

Hmm that ring a bell on a earlier thread......
So to simplify the question:

I have a select combobox where users can select a item and one "GO"
button.
If you look at this samples:
http://www.mediacollege.com/internet...drop-menu.html
The selected value are the complete url.
But I want to only get the selected value and add it to the url as part
of the query

Jan 10 '06 #3
GTi wrote:
Thomas 'PointedEars' Lahn wrote:
GTi wrote:
> <img border="0" src="./images/FolderOpen.gif" alt="[]" /></span> ^
Either you are misusing XML syntax in HTML, which is a direct _SGML_
application, or you are serving not well-formed XHTML above, since in
XML applications like XHTML all attribute values must be quoted or
double-quoted.


Okidoki but my HTML/XHTML Validator (FireFox) says it should be like
so.


Please trim your quotes to the minimum required to retain context.

Firefox does not include a Validator. It includes an XML parser triggered
by an XML media type that should also recognize the unquoted attribute
value above as not well-formed XHTML if it correctly recognizes the missing
NET delimiter as not well-formed XHTML. For markup validation, use the W3C
Markup Validator: <URL:http://validator.w3.org/>

Unless this is for an intranet or another defined environment, or you are
using an application that requires XHTML, such as CML or MathML, you should
not use XHTML at all; HTML 4.01 suffices then. IE, for example, does not
support XHTML at all, it parses it as wrongfully error-corrected HTML if
served as text/html.
> I want to pass the selected ID to a new window as part of a parameter.


`span' elements are not form controls and so the respective element
objects do not have a `form' property even if they are descendants
of a `form' element.

Your form's data cannot be submitted by users which UA lacks client-side
script support or has it disabled. You should reconsider your approach
and use something more like

<form action="pluginpage.html?DoPostBack=1" target="namexx"
onsubmit="window.open('', 'namexx', 200, 310);">
<select name="EditUnitGUID" size="1" multiple title="Select line"
class="EditField">
<option value="0">Standalone Unit</option>
<option value="1" selected>Connected Unit 1</option>
<option value="2" selected>Connected Unit 2</option>
</select>
<input type="image" border="0" src="images/FolderOpen.gif"
alt="Submit">
<form>


I think you misunderstand - My submit button is placed on another place
on this page and it realy don't mather on this question.


I understood that. What you have not understood is that you introduce a
dependency on client-side scripting needlessly.
This popup window is only a property window of the _selected_ item in
the combobox. The form is NOT submitted to this popupwindow.
Which is a problem, do you not see? Submit a form instead.
[...]
The selected value are the complete url.
But I want to only get the selected value and add it to the url as part
of the query


This and the URL encoding for the URL component which you omitted, is done
by the UA when it submits the form data. Write valid markup, then test,
then complain. In that order.
PointedEars
Jan 10 '06 #4
GTi
Just for infomation - This is what I was looking for:

<select class="EditField" size="1" name="MachineClass" onchange=
"OpenNewPopupwindow(this); return(false);">
<option value="noselection">Select New Machine To Add</option>
<option value="MachineClass1">Type 1 machine</option>
<option value="MachineClass2">Type 2 machine</option>
</select>
<script type="text/javascript">
function OpenNewPopupwindow(obj)
{
var selIndex = obj.selectedIndex;
obj.selectedIndex=0;
if(selIndex==0) return;
var selValue = obj.options[selIndex].value;
var urlvar = 'pluginpage.html?EditObject=0&amp;Class='+selValue ;
NewWindow(''+urlvar+'','popup',300,300);
}
</script>

Jan 11 '06 #5
GTi wrote:
Just for infomation - This is what I was looking for:

[...]


And you almost got that (removing the `multiple' attribute from my solution
would get you exactly that behavior), in contrast to your solution without
any dependency on client-side scripting and with a properly encoded URL,
but still using client-side scripting for the popup if supported. If you
still do not understand that, you have much more to learn.
PointedEars
Jan 11 '06 #6

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

Similar topics

0
by: Jan | last post by:
I store sql-commands in a database table. In the first step I get the sql command out of the database table with embedded sql. In the second step I try to execute the command, which i got from the...
2
by: Gadrin77 | last post by:
as a newbie to XSL, is it possible to mimic a SELECT/CASE statement using XSL? I tried a quickie and I kept getting errors either using PARAM or WITH-PARAM in the wrong place or VARIABLE. I...
6
by: passion_to_be_free | last post by:
This is probably simple, but I can't seem to find it anywhere. I have have some values stored in javascript variables. I have a <select> dropdown list whose options correspond to these values. I...
2
by: Cali | last post by:
Please bear with me, I have been reading about XSL for a couple hours. I have an XML document that contains multiple <page> tags interspersed throughout the tree. <text> .... <page>1</page>...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
3
by: Patrick | last post by:
Hi All, I'm new to all this and I'm back for more help. I am working with global variables. I'm trying to make my xls just display the data for the defined <moorname>. In my example I am using...
2
by: naima.mans | last post by:
Hello, i want to select 2 following brothers nodes wich are one under another (one closed to another)... i have done one xslt file... but it's not really good.. for example: the xml file:...
7
by: Zhang Weiwu | last post by:
Dear all How does javascript realiablily tell if a variable is a reference to an HTML Element "<select>", without causing browser to pop up error message? if (variable.constructor ==...
2
by: courbiff | last post by:
Hi everybody I'm wrinting a stored procedure in order to use this last one in a migration script. During the writing i've notice that i have to use a variable in a cursor .. For example ...
72
by: viki1967 | last post by:
Hi everyone. Help with this problem. With Google I found this script: var regiondb = new Object() regiondb = ;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.