Re: [WSG] DOM Scripting

2006-03-03 Thread Darren West
Now fixed - the error is a firefox 1.0 bug and the problem was a typo!DazOn 03/03/06, Darren West <[EMAIL PROTECTED]
> wrote:Thanks Richard and Jesse for your earlier help, thats all working
now.  I hope you don't mind but I could do with your assistance
again :-)

I am now trying to clear the default value of a field (which works
fine) and then restore the default value if there is no user input. The
problem is I get the following error:

Error: [Exception... "'Permission denied to get property
XULElement.selectedIndex' when calling method:
[nsIAutoCompletePopup::selectedIndex]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame ::
http://ta.rt-ms.net/teamengine/assets/js/global.js :: anonymous :: line
10"  data: no]
Source File: http://ta.rt-ms.net/teamengine/assets/js/global.js
Line: 10

The files are:

http://ta.rt-ms.net/teamengine/home.html
http://ta.rt-ms.net/teamengine/assets/js/global.js

Thanks guys

Daz

On 02/03/06, [EMAIL PROTECTED]
 <[EMAIL PROTECTED]
> wrote:Hi Daz,
The problem is, your form is being submitted. That's why it looks like it
only highlights for a second.The easiest fix is to change  to >validateForm()". The 'onclick' call itself needs to return false to stopthe submit.
You may want to consider using the onsubmit event on the form instead.This would catch the form being submitted by users hitting Enter.You also might want to consider attaching the event completely in

_javascript_ instead of as an attribute in the HTML. But this is up to you.Cheers,Jesse Skinner
http://www.thefutureoftheweb.com/> Hello All,>
> I am slowly learning the DOM and _javascript_, and have started applying> scripts for validation, the validation part works fine (I think)> however the problem is I am trying to highlight fields which do not
> validate and they only highlight for a second (I think while the field> is checked against a the regular _expression_).>> The pages are:>> 

http://ta.rt-ms.net/validate/emailagent.html> http://ta.rt-ms.net/validate/assets/js/support.js
>> Thanks>> Daz
**The discussion list for  http://webstandardsgroup.org/
 See 
http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help**




Re: [WSG] DOM Scripting

2006-03-03 Thread Darren West
Thanks Richard and Jesse for your earlier help, thats all working
now.  I hope you don't mind but I could do with your assistance
again :-)

I am now trying to clear the default value of a field (which works
fine) and then restore the default value if there is no user input. The
problem is I get the following error:

Error: [Exception... "'Permission denied to get property
XULElement.selectedIndex' when calling method:
[nsIAutoCompletePopup::selectedIndex]"  nsresult: "0x8057001e
(NS_ERROR_XPC_JS_THREW_STRING)"  location: "JS frame ::
http://ta.rt-ms.net/teamengine/assets/js/global.js :: anonymous :: line
10"  data: no]
Source File: http://ta.rt-ms.net/teamengine/assets/js/global.js
Line: 10

The files are:

http://ta.rt-ms.net/teamengine/home.html
http://ta.rt-ms.net/teamengine/assets/js/global.js

Thanks guys

Daz

On 02/03/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]
> wrote:Hi Daz,The problem is, your form is being submitted. That's why it looks like it
only highlights for a second.The easiest fix is to change  to >validateForm()". The 'onclick' call itself needs to return false to stopthe submit.
You may want to consider using the onsubmit event on the form instead.This would catch the form being submitted by users hitting Enter.You also might want to consider attaching the event completely in
_javascript_ instead of as an attribute in the HTML. But this is up to you.Cheers,Jesse Skinnerhttp://www.thefutureoftheweb.com/> Hello All,>
> I am slowly learning the DOM and _javascript_, and have started applying> scripts for validation, the validation part works fine (I think)> however the problem is I am trying to highlight fields which do not
> validate and they only highlight for a second (I think while the field> is checked against a the regular _expression_).>> The pages are:>> 
http://ta.rt-ms.net/validate/emailagent.html> http://ta.rt-ms.net/validate/assets/js/support.js>> Thanks>> Daz
**The discussion list for  http://webstandardsgroup.org/ See 
http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help**


Re: [WSG] DOM Scripting

2006-03-02 Thread Richard Stephenson
Hi Darren, what's happening is the form is doing the validation but
it's still submitting. In you preparePage() function  you need to add
an event handler for the form.onsubmit() that returns false unless the
form validates.

something like

function prepareForms() {
for (var i=0; i < document.forms.length; i++) {
var thisform = document.forms[i];
thisform.onsubmit = function() {
return validateForm(this);
}
}
return false;
}

Jeremey has an example on
http://www.domscripting.com/domsters/contact.html or have a look at my
comments form.

Best of luck,

Richard

--
DonkeyMagic: Website design & development
http://www.donkeymagic.co.uk
**
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
**



Re: [WSG] DOM Scripting

2006-03-02 Thread jesse
Hi Daz,

The problem is, your form is being submitted. That's why it looks like it
only highlights for a second.

The easiest fix is to change onclick="validateForm()" to onclick="return
validateForm()". The 'onclick' call itself needs to return false to stop
the submit.

You may want to consider using the onsubmit event on the form instead.
This would catch the form being submitted by users hitting Enter.

You also might want to consider attaching the event completely in
JavaScript instead of as an attribute in the HTML. But this is up to you.

Cheers,
Jesse Skinner
http://www.thefutureoftheweb.com/

> Hello All,
>
> I am slowly learning the DOM and Javascript, and have started applying
> scripts for validation, the validation part works fine (I think)
> however the problem is I am trying to highlight fields which do not
> validate and they only highlight for a second (I think while the field
> is checked against a the regular expression).
>
> The pages are:
>
> http://ta.rt-ms.net/validate/emailagent.html
> http://ta.rt-ms.net/validate/assets/js/support.js
>
> Thanks
>
> Daz


**
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
**