By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,369 Members | 950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,369 IT Pros & Developers. It's quick & easy.

Select variable

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.