473,765 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

form element name creates problem

TJS
how can I reference an element name if it has a colon in it ?

example that creates error :
=============== ============
objForm._ctl1:p assword.require d = 1;
Jul 23 '05 #1
13 1620
On Sun, 19 Sep 2004 11:04:05 -0700, TJS <no****@here.co m> wrote:
how can I reference an element name if it has a colon in it ?


Please read the FAQ.

<URL:http://jibbering.com/faq/>

Good luck,
Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
TJS
thanks that works ...

can you help me with the quotes in the eval too?

code
===========
eval(" 'objForm.elemen ts.[\'' + FullElemName + '\'].required = 1' ");

Error: missing ; before statement
=============== ===============
Line: 40, Column: 22
Source Code:

'objForm.elemen ts.[' ' + FullElemName + ''].required = 1'


"Michael Winter" <M.******@bluey onder.co.invali d> wrote in message
news:opsek56ndr x13kvk@atlantis ...
On Sun, 19 Sep 2004 11:04:05 -0700, TJS <no****@here.co m> wrote:
how can I reference an element name if it has a colon in it ?


Please read the FAQ.

<URL:http://jibbering.com/faq/>

Good luck,
Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.

Jul 23 '05 #3
On Sun, 19 Sep 2004 11:37:25 -0700, TJS <no****@here.co m> wrote:
can you help me with the quotes in the eval too?
What eval? The code the FAQ suggests doesn't need one. I suggest you read
4.40 and 4.39, too.
eval(" 'objForm.elemen ts.[\'' + FullElemName + '\'].required = 1' ");


Using your original example:

objForm.element s['_ctll:password '].required = 1;

Note the position of the periods.

If required is a boolean, use boolean values:

objForm.element s['_ctll:password '].required = true;

Hope that helps,
Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #4
TJS wrote:
thanks that works ...

can you help me with the quotes in the eval too?
The best advice you will get with respect to that code is, read the FAQ,
with regards to eval. You don't need it there.
code
===========
eval(" 'objForm.elemen ts.[\'' + FullElemName + '\'].required = 1' ");
objForm.element s[FullElemName].required = 1;

Appears to be what you are after.

If its not, then explain what you are after.

Error: missing ; before statement
=============== ===============
Line: 40, Column: 22
Source Code:

'objForm.elemen ts.[' ' + FullElemName + ''].required = 1'


Looks like an IE error message, which are generally useless.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #5
TJS
i need it to be dynamic

this worked

eval("objForm.e lements[\'" + FullElemName + "\'].required = 1");

thanks for replying
"Randy Webb" <Hi************ @aol.com> wrote in message
news:wd******** ************@co mcast.com...
TJS wrote:
thanks that works ...

can you help me with the quotes in the eval too?


The best advice you will get with respect to that code is, read the FAQ,
with regards to eval. You don't need it there.
code
===========
eval(" 'objForm.elemen ts.[\'' + FullElemName + '\'].required = 1' ");


objForm.element s[FullElemName].required = 1;

Appears to be what you are after.

If its not, then explain what you are after.

Error: missing ; before statement
=============== ===============
Line: 40, Column: 22
Source Code:

'objForm.elemen ts.[' ' + FullElemName + ''].required = 1'


Looks like an IE error message, which are generally useless.
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq

Jul 23 '05 #6
TJS wrote:
i need it to be dynamic

this worked

eval("objForm.e lements[\'" + FullElemName + "\'].required = 1");

thanks for replying


The code I gave is dynamic as well.

Assuming objForm is a reference to the form, and that FullElemName is a
variable containing the name of an element:

objForm.element s[FullElemName].required=1;

But with the way you have it written, it appears to be giving this instead:

objForm.element s['FullElemName'].required=1;

which is not dynamic and I doubt its what you are after.

And please read the FAQ, in its entirety. It covers both questions you
have asked, and it also covers top-posting which is frowned upon in this
particular group.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #7
TJS
I saw FAQ 4.13 which showed using quotes so I tried to follow example.
The eval formula shown produced the actual name inside qoutes and it did
work.

But, the short version works too , so I will use that.

( I hate bottom posting )

cheers


"Randy Webb" <Hi************ @aol.com> wrote in message
news:mL******** ************@co mcast.com...
TJS wrote:
i need it to be dynamic

this worked

eval("objForm.e lements[\'" + FullElemName + "\'].required = 1");

thanks for replying
The code I gave is dynamic as well.

Assuming objForm is a reference to the form, and that FullElemName is a
variable containing the name of an element:

objForm.element s[FullElemName].required=1;

But with the way you have it written, it appears to be giving this

instead:
objForm.element s['FullElemName'].required=1;

which is not dynamic and I doubt its what you are after.

And please read the FAQ, in its entirety. It covers both questions you
have asked, and it also covers top-posting which is frowned upon in this
particular group.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq

Jul 23 '05 #8
On Sun, 19 Sep 2004 14:52:38 -0700, TJS wrote:

(Randy Webb)
And please read the FAQ, in its entirety. It covers both questions you
have asked, and it also covers top-posting which is frowned upon in this
particular group.
( I hate bottom posting )


Who said anything about bottom-posting (before you)?
It is not mentioned if the FAQ, nor Randy's post.

Try 'in-line with trimming'..
<http://www.physci.org/codes/javafaq.jsp#net iquette>

Note that the text of the JS FAQ equates to the same
thing, something you might notice, if you read it..

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
Jul 23 '05 #9
TJS wrote:
I saw FAQ 4.13 which showed using quotes so I tried to follow example.
http://jibbering.com/faq/#FAQ4_25 is a better place to look than 4.13
The eval formula shown produced the actual name inside qoutes and it did
work.
http://jibbering.com/faq/#FAQ4_40

Deals with the use of eval.
But, the short version works too , so I will use that.

( I hate bottom posting )


It destroys the following of the conversation.
Why?
Top-posting.
Whats the worst thing on Usenet?


--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #10

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

Similar topics

1
1505
by: InvisibleMan | last post by:
Thanks in advance for any help... I have a piece of code - viewbasket.asp where variable strProdCode and intQuant are pulled from itemsOrdered table on a Loop from the DB (SQL Server) after they have been added, which it does correctly... <form action="checkout.asp" method="post" id="form1" name="form1">
2
2139
by: skubik | last post by:
I'm curious as to whether it's possible to create a Form object and populate it with form element objects, strictly in Javascript, without the need to apply the form to a document. Essentially, I want to do this: tmpFormObj = new Form(); tmpFormObj.target = document.location; // For example. tmpFormObj.method = "POST";
4
9301
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form action="MaintNotification.php?ReqID=5" method="post" name="frm5"> <tr align="left" bgcolor="#dddddd" class="text" onClick="submit()"
4
2542
by: Howard Jess | last post by:
In Opera 8.01 (Linux; Build 1204) and in Opera 7.54 (Windows XP; Build 3865), my form disappears from the HTML markup (below). To summarize: 1) In a <script> block in the <head> I create a form element (part of object/feature/bug detection). 2) There's a <form> element defined in the <body>, with the id 'theForm'. 3) The onload function tries to access that form, and also counts the total number of forms in the document. It fails to...
1
1765
by: jrmsmo | last post by:
Hi there, I have an interesting problem that maybe you pros can suggest how I solve. I'm working with a third party program that serializes an XML document (it was obviously not designed with schema in mind). I created a schema from this document. It works fine. Except for some unknown reason, in a small part of the XML document, this program switches the order around, and of course the validator I built then fails. Its always the same two...
7
3583
by: Venus | last post by:
Hello, I am trying to generate a dynamic form at runtime and would like to do it using "<asp: ..." form elements as follows Build up the string that is placed somewhere in the HTML code the same way like regular input fields can. strForm = "<form name=""myForm"" runat=""server"">" & vbCrLf strForm += "<asp:button name=""myName"" .... runat=""server"" />" & vbCrLf
25
4072
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
27
4753
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it appears that the data goes straight to the processing page, rather than the javascript seeing if data is missing and popping up an alert. I thought it may be because much of the form is populated with data from the db (lists, etc.), but when I leave...
13
3634
by: johnemmatty | last post by:
I am using an asp page in which i dynamically fill the ACTION property of the form. The problem is that whenever i try to redirect to a html page using the javascript:location, it is getting redirected to the location in the ACTION attribute of the form element despite what is assigned to the location attribute of the javascript. <FORM NAME="CRYSTFORM" METHOD=POST ACTION=<%=thisPage%>> : : :
1
10934
by: gzannd | last post by:
I have a problem with submitting a form to a PHP page through a dynamically created IFRAME in IE7. This code works fine in Firefox. However, IE7 submits an empty form--the correct PHP page is called, but no form variables are passed to the page. Here's the client-side code: //Create or reuse an IFRAME to submit data to a specified page. //commandToken: A string that tells the page what to do. //data: Data that the page will work...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9398
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
10007
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
9951
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,...
1
7375
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
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
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5419
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
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

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.