Re: [PHP] Javascript and $_POST

2007-02-08 Thread Robert Cummings
On Thu, 2007-02-08 at 10:21 -0500, Dan Shirah wrote:
> You guys are going to kill me!  I found my problemand it's one of those
> "What the hell were you thinking" issues.

Nah, probably lots of us have been bitten by that. I know I have been in
the past, so now I always name my submit buttons "continue" :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript and $_POST

2007-02-08 Thread Dan Shirah

You guys are going to kill me!  I found my problemand it's one of those
"What the hell were you thinking" issues.

Within my form was a "button" but I stupidly made it a submit when I created
it and therefore the javascript check for submit was finding my button first
and dumping the error.

So, in summary:
function checkForm( )
 {
  document.FormName.submit();
 }
*DOES *work and will pass your $_POST values between pages as long as you
don't make a novice mistake like I did.


On 2/8/07, Jon Anderson <[EMAIL PROTECTED]> wrote:


Jon Anderson wrote:
> ...
>  item.focus();
>   }
> **   alert(onError);
>   **return(false);*
> *}
> ...
Sorry about the "*"s everywhere (there aren't supposed to be any). I
pasted the code in, and Thunderbird thought it was supposed to be bold
for some reason, then converted the bold text to text with "*"s
everywhere while sending as plain-text only.

jon



Re: [PHP] Javascript and $_POST

2007-02-08 Thread Jon Anderson

Jon Anderson wrote:

...
 item.focus();
  }
**   alert(onError);
  **return(false);*
*}
...
Sorry about the "*"s everywhere (there aren't supposed to be any). I 
pasted the code in, and Thunderbird thought it was supposed to be bold 
for some reason, then converted the bold text to text with "*"s 
everywhere while sending as plain-text only.


jon

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript and $_POST

2007-02-08 Thread Jon Anderson

Dan Shirah wrote:

Jon,
 
Tried your method and still got:

*Error: Object doesn't support this property or method.
Code: 0*
*I don't know what browser/platform you're using, but the following 
works for me on IE7/Windows, FF2/Linux, Opera9/Linux.


jon




function checkInputValue(item,onError) {
  if (item = document.getElementsByName(item)[0]) {
 if (item.value != "") {
return(true);
 }
 item.focus();
  }
**   alert(onError);
  **return(false);*
*}

function checkForm() {
  elements = new Array('cc_phone_number');
  errors = new Array('Please enter a phone number');

  for (i=0;i





onclick="javascript:checkForm();return(false);" title="Save">Save







*

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript and $_POST

2007-02-08 Thread T . Lensselink
Don't see how this can pass the check without document.

if (inputForm.cc_phone_number.value == "") {
alert( "Please enter a phone number." );
inputForm.cc_phone_number.focus();
return;
}

Comming to this check already gives an error.
Maybe ask on some Javascript list.

P.s. reply to the list please. 

On Thu, 8 Feb 2007 09:45:59 -0500, "Dan Shirah" <[EMAIL PROTECTED]> wrote:
> Okay, here is ALL of my checkForm() function.
> 
> 
> function checkForm() {
> 
> ***This check passes***
>   if (inputForm.cc_phone_number.value == "") {
> alert( "Please enter a phone number." );
> inputForm.cc_phone_number.focus();
> return;
>   }
> 
> 
> ***This check passes***
>if (inputForm.receipt.value == "") {
> alert( "Please select whether or not a receipt was requested." );
> inputForm.receipt.focus();
> return;
>   }
> 
> 
> ***This check passes***
>   if (inputForm.case_number.value == "") {
> alert( "Please enter a case number." );
> inputForm.case_number.focus();
> return;
>   }
> 
> 
> ***This check passes***
>   if (inputForm.cc_first_name.value == "") {
> alert( "Please enter a first name." );
> inputForm.cc_first_name.focus();
> return;
>   }
> 
> 
> ***This check passes***
>   if (inputForm.cc_last_name.value == "") {
> alert( "Please enter a last name." );
> inputForm.cc_last_name.focus();
> return;
>   }
> 
> 
> ***This check passes***
>   if (inputForm.cc_middle_name.value == "") {
> alert( "Please enter a middle name." );
> inputForm.cc_middle_name.focus();
> return;
>   }
> 
> 
> ***This check passes***
>  if (!(document.inputForm.cc_comments.value =="")) {
>   if (document.inputForm.cc_comments.value.length > 250)
>   {
> alert("The Comments must be less than 250 characters.\nIt is currently
> "
> + document.inputForm.window_name.value.length + " characters.");
>document.inputForm.window_name.focus();
>return;
>   }
>  }
> 
> 
> 
> ***Error: Object doesn't support this property or method.
> Code: 0***
>  document.inputForm.submit();
> }
> 
> //-->
> 
> 
> 
> 
> On 2/8/07, T. Lensselink <[EMAIL PROTECTED]> wrote:
>>
>> There is nothing wrong with the way you want to submit this form.
>> Although it's JS :) The sample code you posted was broken in some
> ways...
>>
>> missing document. in JS en missing input field to check.
>>
>> This sample works fine ...
>>
>> test.html
>>
>> 
>> function checkForm() {
>>
>> if (document.inputForm.cc_phone_number.value == "") {
>>alert( "Please enter a phone number." );
>>document.inputForm.cc_phone_number.focus();
>>return;
>> }
>>
>> document.inputForm.submit();
>> }
>>
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> Submit a New Payment.
>> 
>>
>> > enctype="multipart/form-data">
>> 
>> > width="680">
>> 
>>> title="Save">Save
>>> title="Close">Close
>> 
>> 
>> 
>>
>> 
>> 
>>
>> save.phhp
>>
>> 
>>
>> Think some other code or JS errors might stop the form from sending
> data.
>>
>>
>>
>> On Thu, 8 Feb 2007 09:09:34 -0500, "Dan Shirah" <[EMAIL PROTECTED]>
>> wrote:
>> > Nope, same result unfortunately.
>> >
>> > On 2/8/07, Németh Zoltán <[EMAIL PROTECTED]> wrote:
>> >>
>> >> On cs, 2007-02-08 at 08:56 -0500, Dan Shirah wrote:
>> >> > Okay, I'll try your spacer solution.   Where do you think I should
>> add
>> >> > it?
>> >>
>> >> I put it right before the  tag, but I think you could put it
>> >> anywhere between the  and the 
>> >>
>> >> greets
>> >> Zoltán Németh
>> >>
>> >> >
>> >> > On 2/8/07, Németh Zoltán <[EMAIL PROTECTED]> wrote:
>> >> > On cs, 2007-02-08 at 08:41 -0500, Dan Shirah wrote:
>> >> > > I should not need an actual Button if my link to
>> checkForm()
>> >> > ends with
>> >> > > document.inputForm.submit(); which tells the form to
>> submit,
>> >> > right?
>> >> >
>> >> > well, you should be right...
>> >> > but I remember a year ago or so I had a similar problem and
>> >> > the image
>> >> > input solved it... but I'm not sure whether it was exactly
>> the
>> >> > same
>> >> > problem or not, so it might be complete bullshit ;)
>> >> >
>> >> > greets
>> >> > Zoltán Németh
>> >> >
>> >> > >
>> >> > > On 2/8/07, Németh Zoltán <[EMAIL PROTECTED]>
> wrote:
>> >> > > On cs, 2007-02-08 at 08:14 -0500, Dan Shirah
> wrote:
>> >> > > > Okay, I edited my page per some suggestions
>> >> > here.  Below is
>> >> > > what I now have:
>> >> > > >
>> >> > > >
>> >> > > > 
>> >> > > > function checkForm() {
>> >> > > >
>> >> > > >  // ** START **
>> >> > > >   if (inputForm.cc_phone_number.value == "") {
>> >> > > > alert( "Please enter a phone number." );
>> >> > > > inputForm.cc_phone_number.focus();
>> >> > > > return;
>> >>

Re: [PHP] Javascript and $_POST

2007-02-08 Thread Dan Shirah

Jon,

Tried your method and still got:
*Error: Object doesn't support this property or method.
Code: 0*



On 2/8/07, Jon Anderson <[EMAIL PROTECTED]> wrote:


I'm no JavaScript expert, but I could maybe suggest an alternate method:
use document.getElementById() or document.getElementsByName()

AFAIK, the direct document.xyz doesn't work exactly the same way accross
browsers (if at all).

e.g. (WARNING! TOTALLY UNTESTED CODE!)

function checkInputValue(item,onError) {
   if (item = document.getElementsByName(item)[0]) {
  if (item.value != "") {
 return(true);
  }
   }
   alert(onError);
   item.focus();
   return(false);
}

function checkForm() {
   elements = new Array('cc_phone_number');
   errors = new Array('Please enter a phone number');

   for (i=0;i Okay, I edited my page per some suggestions here.  Below is what I now
> have:
>
>
> 
> function checkForm() {
>
> // ** START **
>  if (inputForm.cc_phone_number.value == "") {
>alert( "Please enter a phone number." );
>inputForm.cc_phone_number.focus();
>return;
>  }
>
> **Lots of other checks here, just left out for length**
>
>   document.inputForm.submit();
> }
>
> 
> 
> 
> 
> 
>  
>   Submit a New Payment.
> 
>  enctype="multipart/form-data">
>
> **Lots of form data here**
>
>  width="680">
> 
>  title="Save">Save
>  title="Close">Close
> 
> 
> 
> 
> 
>
> Now when I submit my page it still perfroms all of the javascript checks
> correctly, but once it gets to the document.inputForm.submit(); part it
> returns the following error.
>
> Error: Object doesn't support this property or method.
> Code: 0
>
>
>
> On 2/7/07, Paul Novitski <[EMAIL PROTECTED]> wrote:
>>
>> At 2/7/2007 01:34 PM, Dan Shirah wrote:
>> >I have a form that uses Javascript to validate form field entries,
>> and if
>> >they are incorrect it returns an error to the user.
>> >
>> >After the Javascript processing is complete, it submits the form to my
>> save
>> >page. However it seems that once the processing is complete and it
>> passes
>> to
>> >the save page, none of my $_POST variables are being passed.
>>
>>
>> Of course, all of your form fields need to be inside the same
>>  tags as your submit button.  The sample HTML you posted
>> did not indicate that you'd done this.
>>
>> Regards,
>>
>> Paul
>> __
>>
>> Paul Novitski
>> Juniper Webcraft Ltd.
>> http://juniperwebcraft.com
>>
>>
>




Re: [PHP] Javascript and $_POST

2007-02-08 Thread Jon Anderson
I'm no JavaScript expert, but I could maybe suggest an alternate method: 
use document.getElementById() or document.getElementsByName()


AFAIK, the direct document.xyz doesn't work exactly the same way accross 
browsers (if at all).


e.g. (WARNING! TOTALLY UNTESTED CODE!)

function checkInputValue(item,onError) {
   if (item = document.getElementsByName(item)[0]) {
  if (item.value != "") {
 return(true);
  }
   }
   alert(onError);
   item.focus();
   return(false);
}

function checkForm() {
   elements = new Array('cc_phone_number');
   errors = new Array('Please enter a phone number');

   for (i=0;iOkay, I edited my page per some suggestions here.  Below is what I now 
have:




function checkForm() {

// ** START **
 if (inputForm.cc_phone_number.value == "") {
   alert( "Please enter a phone number." );
   inputForm.cc_phone_number.focus();
   return;
 }

**Lots of other checks here, just left out for length**

  document.inputForm.submit();
}






 
  Submit a New Payment.



**Lots of form data here**



Save
Close






Now when I submit my page it still perfroms all of the javascript checks
correctly, but once it gets to the document.inputForm.submit(); part it
returns the following error.

Error: Object doesn't support this property or method.
Code: 0



On 2/7/07, Paul Novitski <[EMAIL PROTECTED]> wrote:


At 2/7/2007 01:34 PM, Dan Shirah wrote:
>I have a form that uses Javascript to validate form field entries, 
and if

>they are incorrect it returns an error to the user.
>
>After the Javascript processing is complete, it submits the form to my
save
>page. However it seems that once the processing is complete and it 
passes

to
>the save page, none of my $_POST variables are being passed.


Of course, all of your form fields need to be inside the same
 tags as your submit button.  The sample HTML you posted
did not indicate that you'd done this.

Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript and $_POST

2007-02-08 Thread Németh Zoltán
On cs, 2007-02-08 at 09:09 -0500, Dan Shirah wrote:
> Nope, same result unfortunately.

well, sorry, then my memories were incorrect
maybe I should run a memtest86 on myself ;)

greets
Zoltán Németh

> 
> On 2/8/07, Németh Zoltán <[EMAIL PROTECTED]> wrote: 
> On cs, 2007-02-08 at 08:56 -0500, Dan Shirah wrote:
> > Okay, I'll try your spacer solution.   Where do you think I
> should add 
> > it?
> 
> I put it right before the  tag, but I think you could
> put it
> anywhere between the  and the 
> 
> greets
> Zoltán Németh
> 
> >
> > On 2/8/07, Németh Zoltán < [EMAIL PROTECTED]> wrote:
> > On cs, 2007-02-08 at 08:41 -0500, Dan Shirah wrote:
> > > I should not need an actual Button if my link to
> checkForm() 
> > ends with
> > > document.inputForm.submit(); which tells the form
> to submit,
> > right?
> >
> > well, you should be right...
> > but I remember a year ago or so I had a similar
> problem and 
> > the image
> > input solved it... but I'm not sure whether it was
> exactly the
> > same
> > problem or not, so it might be complete bullshit ;)
> >
> > greets 
> > Zoltán Németh
> >
> > >
> > > On 2/8/07, Németh Zoltán <[EMAIL PROTECTED]>
> wrote:
> > > On cs, 2007-02-08 at 08:14 -0500, Dan
> Shirah wrote: 
> > > > Okay, I edited my page per some
> suggestions
> > here.  Below is
> > > what I now have:
> > > >
> > > > 
> > > > 
> > > > function checkForm() {
> > > >
> > > >  // ** START ** 
> > > >   if (inputForm.cc_phone_number.value ==
> "") {
> > > > alert( "Please enter a phone
> number." );
> > > > inputForm.cc_phone_number.focus ();
> > > > return;
> > > >   }
> > > >
> > > > **Lots of other checks here, just
> left out for
> > > length** 
> > > >
> > > >document.inputForm.submit();
> > > > }
> > > >
> > > > 
> > > > 
> > > >  > > href="../../CSS/background.css"> 
> > > > 
> > > > 
> > > >  
> > > >Submit a New Payment. 
> > > > 
> > > >  > method="post"
> > > > enctype="multipart/form-data"> 
> > > >
> > > > **Lots of form data here**
> > > >
> > > >  cellpadding="0" 
> > > cellspacing="0"
> > > > width="680">
> > > >  
> > > >   > > href="javascript:checkForm()"
> > > > title="Save">Save
> > > >   > > href="javascript:closeThis()"
> > > > title="Close">Close
> > > >  
> > > >  
> > > > 
> > > > 
> > > > 
> > > >
> > > > Now when I submit my page it still
> perfroms all of 
> > the
> > > javascript checks
> > > > correctly, but once it gets to the
> > > document.inputForm.submit(); part it
> > > > returns the following error. 
> > > >
> > > > Error: Object doesn't support this
> property or
> > method.
> > > > Code: 0
> > > >
> > >
> > > maybe because you don't have submit button
> in the
> > form?
> > > try to include something like this
> > >  src="./images/spacer.gif"> 
> > > where spacer.gif is an 1x1 blank image
> > >
> > > I r

Re: [PHP] Javascript and $_POST

2007-02-08 Thread T . Lensselink
There is nothing wrong with the way you want to submit this form.
Although it's JS :) The sample code you posted was broken in some ways...

missing document. in JS en missing input field to check.

This sample works fine ... 

test.html


function checkForm() {

if (document.inputForm.cc_phone_number.value == "") {
alert( "Please enter a phone number." );
document.inputForm.cc_phone_number.focus();
return;
}

document.inputForm.submit();
}






 

Submit a New Payment.






Save
Close







save.phhp



Think some other code or JS errors might stop the form from sending data.



On Thu, 8 Feb 2007 09:09:34 -0500, "Dan Shirah" <[EMAIL PROTECTED]> wrote:
> Nope, same result unfortunately.
> 
> On 2/8/07, Németh Zoltán <[EMAIL PROTECTED]> wrote:
>>
>> On cs, 2007-02-08 at 08:56 -0500, Dan Shirah wrote:
>> > Okay, I'll try your spacer solution.   Where do you think I should add
>> > it?
>>
>> I put it right before the  tag, but I think you could put it
>> anywhere between the  and the 
>>
>> greets
>> Zoltán Németh
>>
>> >
>> > On 2/8/07, Németh Zoltán <[EMAIL PROTECTED]> wrote:
>> > On cs, 2007-02-08 at 08:41 -0500, Dan Shirah wrote:
>> > > I should not need an actual Button if my link to checkForm()
>> > ends with
>> > > document.inputForm.submit(); which tells the form to submit,
>> > right?
>> >
>> > well, you should be right...
>> > but I remember a year ago or so I had a similar problem and
>> > the image
>> > input solved it... but I'm not sure whether it was exactly the
>> > same
>> > problem or not, so it might be complete bullshit ;)
>> >
>> > greets
>> > Zoltán Németh
>> >
>> > >
>> > > On 2/8/07, Németh Zoltán <[EMAIL PROTECTED]> wrote:
>> > > On cs, 2007-02-08 at 08:14 -0500, Dan Shirah wrote:
>> > > > Okay, I edited my page per some suggestions
>> > here.  Below is
>> > > what I now have:
>> > > >
>> > > >
>> > > > 
>> > > > function checkForm() {
>> > > >
>> > > >  // ** START **
>> > > >   if (inputForm.cc_phone_number.value == "") {
>> > > > alert( "Please enter a phone number." );
>> > > > inputForm.cc_phone_number.focus();
>> > > > return;
>> > > >   }
>> > > >
>> > > > **Lots of other checks here, just left out for
>> > > length**
>> > > >
>> > > >document.inputForm.submit();
>> > > > }
>> > > >
>> > > > 
>> > > > 
>> > > > > > > href="../../CSS/background.css">
>> > > > 
>> > > > 
>> > > >  
>> > > >Submit a New Payment.
>> > > > 
>> > > > > > method="post"
>> > > > enctype="multipart/form-data">
>> > > >
>> > > > **Lots of form data here**
>> > > >
>> > > > > > > cellspacing="0"
>> > > > width="680">
>> > > >  
>> > > >  > > > href="javascript:checkForm()"
>> > > > title="Save">Save
>> > > >  > > > href="javascript:closeThis()"
>> > > > title="Close">Close
>> > > >  
>> > > > 
>> > > > 
>> > > > 
>> > > > 
>> > > >
>> > > > Now when I submit my page it still perfroms all of
>> > the
>> > > javascript checks
>> > > > correctly, but once it gets to the
>> > > document.inputForm.submit(); part it
>> > > > returns the following error.
>> > > >
>> > > > Error: Object doesn't support this property or
>> > method.
>> > > > Code: 0
>> > > >
>> > >
>> > > maybe because you don't have submit button in the
>> > form?
>> > > try to include something like this
>> > > 
>> > > where spacer.gif is an 1x1 blank image
>> > >
>> > > I remember some similar situation where it helped,
>> > but I'm not
>> > > sure
>> > >
>> > > hope that helps
>> > > Zoltán Németh
>> > >
>> > > >
>> > > >
>> > > > On 2/7/07, Paul Novitski
>> > <[EMAIL PROTECTED]> wrote:
>> > > > >
>> > > > > At 2/7/2007 01:34 PM, Dan S

Re: [PHP] Javascript and $_POST

2007-02-08 Thread Dan Shirah

Nope, same result unfortunately.

On 2/8/07, Németh Zoltán <[EMAIL PROTECTED]> wrote:


On cs, 2007-02-08 at 08:56 -0500, Dan Shirah wrote:
> Okay, I'll try your spacer solution.   Where do you think I should add
> it?

I put it right before the  tag, but I think you could put it
anywhere between the  and the 

greets
Zoltán Németh

>
> On 2/8/07, Németh Zoltán <[EMAIL PROTECTED]> wrote:
> On cs, 2007-02-08 at 08:41 -0500, Dan Shirah wrote:
> > I should not need an actual Button if my link to checkForm()
> ends with
> > document.inputForm.submit(); which tells the form to submit,
> right?
>
> well, you should be right...
> but I remember a year ago or so I had a similar problem and
> the image
> input solved it... but I'm not sure whether it was exactly the
> same
> problem or not, so it might be complete bullshit ;)
>
> greets
> Zoltán Németh
>
> >
> > On 2/8/07, Németh Zoltán <[EMAIL PROTECTED]> wrote:
> > On cs, 2007-02-08 at 08:14 -0500, Dan Shirah wrote:
> > > Okay, I edited my page per some suggestions
> here.  Below is
> > what I now have:
> > >
> > >
> > > 
> > > function checkForm() {
> > >
> > >  // ** START **
> > >   if (inputForm.cc_phone_number.value == "") {
> > > alert( "Please enter a phone number." );
> > > inputForm.cc_phone_number.focus();
> > > return;
> > >   }
> > >
> > > **Lots of other checks here, just left out for
> > length**
> > >
> > >document.inputForm.submit();
> > > }
> > >
> > > 
> > > 
> > >  > href="../../CSS/background.css">
> > > 
> > > 
> > >  
> > >Submit a New Payment.
> > > 
> > >  method="post"
> > > enctype="multipart/form-data">
> > >
> > > **Lots of form data here**
> > >
> > >  > cellspacing="0"
> > > width="680">
> > >  
> > >   > href="javascript:checkForm()"
> > > title="Save">Save
> > >   > href="javascript:closeThis()"
> > > title="Close">Close
> > >  
> > > 
> > > 
> > > 
> > > 
> > >
> > > Now when I submit my page it still perfroms all of
> the
> > javascript checks
> > > correctly, but once it gets to the
> > document.inputForm.submit(); part it
> > > returns the following error.
> > >
> > > Error: Object doesn't support this property or
> method.
> > > Code: 0
> > >
> >
> > maybe because you don't have submit button in the
> form?
> > try to include something like this
> > 
> > where spacer.gif is an 1x1 blank image
> >
> > I remember some similar situation where it helped,
> but I'm not
> > sure
> >
> > hope that helps
> > Zoltán Németh
> >
> > >
> > >
> > > On 2/7/07, Paul Novitski
> <[EMAIL PROTECTED]> wrote:
> > > >
> > > > At 2/7/2007 01:34 PM, Dan Shirah wrote:
> > > > >I have a form that uses Javascript to validate
> form field
> > entries, and if
> > > > >they are incorrect it returns an error to the
> user.
> > > > >
> > > > >After the Javascript processing is complete, it
> submits
> > the form to my
> > > > save
> > > > >page. However it seems that once the processing
> is
> > complete and it passes
> > > > to
> > > > >the save page, none of my $_POST variables are
> being
> > passed.
> > > >
> > > >
> > > > Of course, all of your form fields need to be
> inside the
> > same
> > > >  tags as your submit button.  The
> sample HTML
> > you posted
> > > > did not indicate that you'd done this.
> 

Re: [PHP] Javascript and $_POST

2007-02-08 Thread Németh Zoltán
On cs, 2007-02-08 at 08:56 -0500, Dan Shirah wrote:
> Okay, I'll try your spacer solution.   Where do you think I should add
> it?

I put it right before the  tag, but I think you could put it
anywhere between the  and the 

greets
Zoltán Németh

> 
> On 2/8/07, Németh Zoltán <[EMAIL PROTECTED]> wrote: 
> On cs, 2007-02-08 at 08:41 -0500, Dan Shirah wrote:
> > I should not need an actual Button if my link to checkForm()
> ends with 
> > document.inputForm.submit(); which tells the form to submit,
> right?
> 
> well, you should be right...
> but I remember a year ago or so I had a similar problem and
> the image
> input solved it... but I'm not sure whether it was exactly the
> same 
> problem or not, so it might be complete bullshit ;)
> 
> greets
> Zoltán Németh
> 
> >
> > On 2/8/07, Németh Zoltán <[EMAIL PROTECTED]> wrote:
> > On cs, 2007-02-08 at 08:14 -0500, Dan Shirah wrote: 
> > > Okay, I edited my page per some suggestions
> here.  Below is
> > what I now have:
> > >
> > >
> > >  
> > > function checkForm() {
> > >
> > >  // ** START **
> > >   if (inputForm.cc_phone_number.value == "") {
> > > alert( "Please enter a phone number." ); 
> > > inputForm.cc_phone_number.focus();
> > > return;
> > >   }
> > >
> > > **Lots of other checks here, just left out for
> > length** 
> > >
> > >document.inputForm.submit();
> > > }
> > >
> > > 
> > > 
> > >  > href="../../CSS/background.css">
> > > 
> > > 
> > >  
> > >Submit a New Payment. 
> > > 
> > >  method="post"
> > > enctype="multipart/form-data">
> > > 
> > > **Lots of form data here**
> > >
> > >  > cellspacing="0" 
> > > width="680">
> > >  
> > >   > href="javascript:checkForm()"
> > > title="Save">Save
> > >   > href="javascript:closeThis()"
> > > title="Close">Close 
> > >  
> > > 
> > > 
> > > 
> > > 
> > >
> > > Now when I submit my page it still perfroms all of
> the 
> > javascript checks
> > > correctly, but once it gets to the
> > document.inputForm.submit(); part it
> > > returns the following error.
> > >
> > > Error: Object doesn't support this property or
> method. 
> > > Code: 0
> > >
> >
> > maybe because you don't have submit button in the
> form?
> > try to include something like this
> >  
> > where spacer.gif is an 1x1 blank image
> >
> > I remember some similar situation where it helped,
> but I'm not
> > sure
> >
> > hope that helps
> > Zoltán Németh 
> >
> > >
> > >
> > > On 2/7/07, Paul Novitski
> <[EMAIL PROTECTED]> wrote:
> > > >
> > > > At 2/7/2007 01:34 PM, Dan Shirah wrote: 
> > > > >I have a form that uses Javascript to validate
> form field
> > entries, and if
> > > > >they are incorrect it returns an error to the
> user.
> > > > > 
> > > > >After the Javascript processing is complete, it
> submits
> > the form to my
> > > > save
> > > > >page. However it seems that once the processing
> is 
> > complete and it passes
> > > > to
> > > > >the save page, none of my $_POST variables are
> being
> > passed.
> > > >
> > > > 
> > > > Of course, all of your form fields need to be
> inside the
> > same
> > > >  tags as your submit button.  The
> sample HTML
> > you posted 
> > > > did not indicate that you'd done this.
> > > >
> > > > Reg

Re: [PHP] Javascript and $_POST

2007-02-08 Thread Németh Zoltán
On cs, 2007-02-08 at 08:41 -0500, Dan Shirah wrote:
> I should not need an actual Button if my link to checkForm() ends with
> document.inputForm.submit(); which tells the form to submit, right?

well, you should be right...
but I remember a year ago or so I had a similar problem and the image
input solved it... but I'm not sure whether it was exactly the same
problem or not, so it might be complete bullshit ;)

greets
Zoltán Németh

> 
> On 2/8/07, Németh Zoltán <[EMAIL PROTECTED]> wrote: 
> On cs, 2007-02-08 at 08:14 -0500, Dan Shirah wrote:
> > Okay, I edited my page per some suggestions here.  Below is
> what I now have: 
> >
> >
> > 
> > function checkForm() {
> >
> >  // ** START **
> >   if (inputForm.cc_phone_number.value == "") {
> > alert( "Please enter a phone number." ); 
> > inputForm.cc_phone_number.focus();
> > return;
> >   }
> >
> > **Lots of other checks here, just left out for
> length**
> >
> >document.inputForm.submit();
> > }
> >
> > 
> > 
> >  href="../../CSS/background.css">
> > 
> >  
> >  
> >Submit a New Payment.
> > 
> >  > enctype="multipart/form-data">
> >
> > **Lots of form data here**
> >
> >  cellspacing="0" 
> > width="680">
> >  
> >   href="javascript:checkForm()"
> > title="Save">Save 
> >   href="javascript:closeThis()"
> > title="Close">Close
> >  
> > 
> >  
> > 
> > 
> >
> > Now when I submit my page it still perfroms all of the
> javascript checks
> > correctly, but once it gets to the
> document.inputForm.submit(); part it
> > returns the following error. 
> >
> > Error: Object doesn't support this property or method.
> > Code: 0
> >
> 
> maybe because you don't have submit button in the form?
> try to include something like this
>  
> where spacer.gif is an 1x1 blank image
> 
> I remember some similar situation where it helped, but I'm not
> sure
> 
> hope that helps
> Zoltán Németh
> 
> >
> >
> > On 2/7/07, Paul Novitski <[EMAIL PROTECTED]> wrote:
> > >
> > > At 2/7/2007 01:34 PM, Dan Shirah wrote:
> > > >I have a form that uses Javascript to validate form field
> entries, and if
> > > >they are incorrect it returns an error to the user. 
> > > >
> > > >After the Javascript processing is complete, it submits
> the form to my
> > > save
> > > >page. However it seems that once the processing is
> complete and it passes
> > > to 
> > > >the save page, none of my $_POST variables are being
> passed.
> > >
> > >
> > > Of course, all of your form fields need to be inside the
> same
> > >  tags as your submit button.  The sample HTML
> you posted 
> > > did not indicate that you'd done this.
> > >
> > > Regards,
> > >
> > > Paul
> > > __
> > >
> > > Paul Novitski
> > > Juniper Webcraft Ltd. 
> > > http://juniperwebcraft.com
> > >
> > >
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript and $_POST

2007-02-08 Thread Németh Zoltán
On cs, 2007-02-08 at 08:14 -0500, Dan Shirah wrote:
> Okay, I edited my page per some suggestions here.  Below is what I now have:
> 
> 
> 
> function checkForm() {
> 
>  // ** START **
>   if (inputForm.cc_phone_number.value == "") {
> alert( "Please enter a phone number." );
> inputForm.cc_phone_number.focus();
> return;
>   }
> 
> **Lots of other checks here, just left out for length**
> 
>document.inputForm.submit();
> }
> 
> 
> 
> 
> 
> 
>  
>Submit a New Payment.
> 
>  enctype="multipart/form-data">
> 
> **Lots of form data here**
> 
>  width="680">
>  
>   title="Save">Save
>   title="Close">Close
>  
> 
> 
> 
> 
> 
> Now when I submit my page it still perfroms all of the javascript checks
> correctly, but once it gets to the document.inputForm.submit(); part it
> returns the following error.
> 
> Error: Object doesn't support this property or method.
> Code: 0
> 

maybe because you don't have submit button in the form?
try to include something like this

where spacer.gif is an 1x1 blank image

I remember some similar situation where it helped, but I'm not sure

hope that helps
Zoltán Németh

> 
> 
> On 2/7/07, Paul Novitski <[EMAIL PROTECTED]> wrote:
> >
> > At 2/7/2007 01:34 PM, Dan Shirah wrote:
> > >I have a form that uses Javascript to validate form field entries, and if
> > >they are incorrect it returns an error to the user.
> > >
> > >After the Javascript processing is complete, it submits the form to my
> > save
> > >page. However it seems that once the processing is complete and it passes
> > to
> > >the save page, none of my $_POST variables are being passed.
> >
> >
> > Of course, all of your form fields need to be inside the same
> >  tags as your submit button.  The sample HTML you posted
> > did not indicate that you'd done this.
> >
> > Regards,
> >
> > Paul
> > __
> >
> > Paul Novitski
> > Juniper Webcraft Ltd.
> > http://juniperwebcraft.com
> >
> >

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript and $_POST

2007-02-08 Thread Dan Shirah

Okay, I edited my page per some suggestions here.  Below is what I now have:



function checkForm() {

// ** START **
 if (inputForm.cc_phone_number.value == "") {
   alert( "Please enter a phone number." );
   inputForm.cc_phone_number.focus();
   return;
 }

**Lots of other checks here, just left out for length**

  document.inputForm.submit();
}






 
  Submit a New Payment.



**Lots of form data here**



Save
Close






Now when I submit my page it still perfroms all of the javascript checks
correctly, but once it gets to the document.inputForm.submit(); part it
returns the following error.

Error: Object doesn't support this property or method.
Code: 0



On 2/7/07, Paul Novitski <[EMAIL PROTECTED]> wrote:


At 2/7/2007 01:34 PM, Dan Shirah wrote:
>I have a form that uses Javascript to validate form field entries, and if
>they are incorrect it returns an error to the user.
>
>After the Javascript processing is complete, it submits the form to my
save
>page. However it seems that once the processing is complete and it passes
to
>the save page, none of my $_POST variables are being passed.


Of course, all of your form fields need to be inside the same
 tags as your submit button.  The sample HTML you posted
did not indicate that you'd done this.

Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com




Re: [PHP] Javascript and $_POST

2007-02-07 Thread Paul Novitski

At 2/7/2007 01:34 PM, Dan Shirah wrote:

I have a form that uses Javascript to validate form field entries, and if
they are incorrect it returns an error to the user.

After the Javascript processing is complete, it submits the form to my save
page. However it seems that once the processing is complete and it passes to
the save page, none of my $_POST variables are being passed.



Of course, all of your form fields need to be inside the same 
 tags as your submit button.  The sample HTML you posted 
did not indicate that you'd done this.


Regards,

Paul
__

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Javascript and $_POST

2007-02-07 Thread Jon Anderson

Dan Shirah wrote:

And this is my Save option at the bottom of my page




Save


 
ErWhy aren't there any input elements within the  tag? Maybe 
you just condensed-out the inputs, but if your inputs aren't within the 
form, they won't be submitted.


E.g. if you have:







...


If you submit "submitForm", nothing will get posted. You want to post 
"dataForm" in the above example. (Or whatever "inputForm" happens to be 
in your example.)


jon

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Javascript and $_POST

2007-02-07 Thread Brad Fuller
> -Original Message-
> From: Dan Shirah [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 07, 2007 4:35 PM
> To: php-general
> Subject: [PHP] Javascript and $_POST
> 
> I have a form that uses Javascript to validate form field entries, and if
> they are incorrect it returns an error to the user.
> 
> After the Javascript processing is complete, it submits the form to my
> save
> page. However it seems that once the processing is complete and it passes
> to
> the save page, none of my $_POST variables are being passed.
> 
> Is this normal, or is there a work around for it?
> 
> My Javascript has multiple checks. Below is a very condensed version:
> 
> 
> function checkForm() {
> 
> if (inputForm.cc_phone_number.value == "") {
> alert( "Please enter a phone number." );
> inputForm.cc_phone_number.focus();
> return;
> }
> 
> document.Submit.submit();
> }
> 
> 
> And this is my Save option at the bottom of my page
> 
>  enctype="multipart/form-data">
>  width="680">
> 
>  title="Save">Save
> 
> 
> 
> 
> When I click on save, it does go thru all the checks correctly and prompts
> to enter info if anything is left out. It then passes me to the
> save.phppage as it should, but all of my $_POST('X') values come
> in blank.


>From the looks of it, you have two forms - one called "Submit" and one
called "inputForm".  You need to submit the "inputForm" for the values to be
passed to the processing page.

document.inputForm.submit();

HTH,

Brad



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php