[Proto-Scripty] Re: Prototype and forms

2009-06-17 Thread anthony

Thanks for the cleanup. I have made those changes. Feel free to post
others. The problem I have is that the form had two dynamic places:

div id=territories/div
and
div id=adjForm/div

There is an onChange that calls the javascript function getTerritories
() allows the
div id=territories/div to display which has a form element
called territory. At the end of the same function, it calls the other
javascript function getAdjForm(). getAdjForm() looks to see if the
form element territory exists. That's the problem, for some reason, it
cannot see it. What can I do to make it where it does not fail the if
statement in that function?

On Jun 16, 11:33 am, Rick Waldron waldron.r...@gmail.com wrote:
 A few things...

  var params = Form.serialize($('createAdjForm'));

 You can clean this up as:

  var params = $('createAdjForm').serialize();

 There are other points that you could optimize, but thats not your
 question...

 And at whatever point you want adjForm to appear, you need to add:

 $('adjForm').show()

 Rick

 On Mon, Jun 15, 2009 at 5:46 PM, anthony mrsmi...@gmail.com wrote:

  I have a form that when a user selects something from a drop-down,
  another element in the form appears. There is another piece of the
  form, that is never showing up, I need to understand what I am doing
  wrong and how to fix it:

  script type=text/javascript language=JavaScript
  function getAdjForm() {

        var params = Form.serialize($('createAdjForm'));
  alert($('territory').value);

         if ($('adjType').value !==   $('territory').value !== ){

                 new Ajax.Updater(
                 adjForm,
                 ?= $this-url(array('controller'='index',
  'action'='get-adj-
  form'))?,
                 {method:'post',
                 parameters: params});
         }
  }

  function getTerritories() {

         var params = Form.serialize($('createAdjForm'));
         new Ajax.Updater(
         territories,
         ?= $this-url(array('controller'='index', 'action'='get-
  territories'))?,
         {method:'post',
         parameters: params});

         if ($('adjType').value !== ){
                 //alert('d');
                 getAdjForm();
         }
  }

  function getCustomer() {

         var params = Form.serialize($('createAdjForm'));
         new Ajax.Updater(
         customer,
         ?= $this-url(array('controller'='index', 'action'='get-
  customer'))?,
         {method:'post',
         parameters: params});
  }

  /script

  form method=POST id=createAdjForm action=
  p

  table border=0 CELLSPACING=10
         tr
                 td
                         bSelect Adjustment Type/b
                 /td
                 td
                         ?php echo $this-formSelect('adjType',
  $this-adjType, array
  (onChange=getAdjForm()), array(=Select an Adjustment Type) +
  $this-adjTypes) ?
                 /td
         /tr
         tr
                 td
                         bSubmitting Territory/b
                 /td
                 td
                         ?php echo $this-formSelect('shortTerritory',
  $this-
  shortTerritory, array(onChange=getTerritories()), array
  (=Select a Territory) + $this-shortTerritories) ?
                         div id=territories/div
                 /td
         /tr
         tr
                 td valign=top
                         bJustification/b
                 /td
                 td
                         ?php echo
  $this-formTextarea('justification',$this-
  justification,array(rows=5,cols=75)) ?
                 /td
         /tr
  /table
  hr
  div id=adjForm
  /div

  ***
  This issue is that the data that should be here:
  div id=adjForm
  /div
  Is never showing. When getAdjForm(); is called from getTerritories(),
  the $('territory').value !==  seems to be the problem. Does the
  browser not know that was an element because it just appeared?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Prototype and forms

2009-06-17 Thread anthony

Ok, I have found a better way to explain this.

var params = $('createAdjForm').serialize();
alert(params);

This does not show the form elements that were included via: div
id=territories/div

Why is that the case?


On Jun 17, 9:06 am, anthony mrsmi...@gmail.com wrote:
 Thanks for the cleanup. I have made those changes. Feel free to post
 others. The problem I have is that the form had two dynamic places:

 div id=territories/div
 and
 div id=adjForm/div

 There is an onChange that calls the javascript function getTerritories
 () allows the
 div id=territories/div to display which has a form element
 called territory. At the end of the same function, it calls the other
 javascript function getAdjForm(). getAdjForm() looks to see if the
 form element territory exists. That's the problem, for some reason, it
 cannot see it. What can I do to make it where it does not fail the if
 statement in that function?

 On Jun 16, 11:33 am, Rick Waldron waldron.r...@gmail.com wrote:

  A few things...

   var params = Form.serialize($('createAdjForm'));

  You can clean this up as:

   var params = $('createAdjForm').serialize();

  There are other points that you could optimize, but thats not your
  question...

  And at whatever point you want adjForm to appear, you need to add:

  $('adjForm').show()

  Rick

  On Mon, Jun 15, 2009 at 5:46 PM, anthony mrsmi...@gmail.com wrote:

   I have a form that when a user selects something from a drop-down,
   another element in the form appears. There is another piece of the
   form, that is never showing up, I need to understand what I am doing
   wrong and how to fix it:

   script type=text/javascript language=JavaScript
   function getAdjForm() {

         var params = Form.serialize($('createAdjForm'));
   alert($('territory').value);

          if ($('adjType').value !==   $('territory').value !== ){

                  new Ajax.Updater(
                  adjForm,
                  ?= $this-url(array('controller'='index',
   'action'='get-adj-
   form'))?,
                  {method:'post',
                  parameters: params});
          }
   }

   function getTerritories() {

          var params = Form.serialize($('createAdjForm'));
          new Ajax.Updater(
          territories,
          ?= $this-url(array('controller'='index', 'action'='get-
   territories'))?,
          {method:'post',
          parameters: params});

          if ($('adjType').value !== ){
                  //alert('d');
                  getAdjForm();
          }
   }

   function getCustomer() {

          var params = Form.serialize($('createAdjForm'));
          new Ajax.Updater(
          customer,
          ?= $this-url(array('controller'='index', 'action'='get-
   customer'))?,
          {method:'post',
          parameters: params});
   }

   /script

   form method=POST id=createAdjForm action=
   p

   table border=0 CELLSPACING=10
          tr
                  td
                          bSelect Adjustment Type/b
                  /td
                  td
                          ?php echo $this-formSelect('adjType',
   $this-adjType, array
   (onChange=getAdjForm()), array(=Select an Adjustment Type) +
   $this-adjTypes) ?
                  /td
          /tr
          tr
                  td
                          bSubmitting Territory/b
                  /td
                  td
                          ?php echo $this-formSelect('shortTerritory',
   $this-
   shortTerritory, array(onChange=getTerritories()), array
   (=Select a Territory) + $this-shortTerritories) ?
                          div id=territories/div
                  /td
          /tr
          tr
                  td valign=top
                          bJustification/b
                  /td
                  td
                          ?php echo
   $this-formTextarea('justification',$this-
   justification,array(rows=5,cols=75)) ?
                  /td
          /tr
   /table
   hr
   div id=adjForm
   /div

   ***
   This issue is that the data that should be here:
   div id=adjForm
   /div
   Is never showing. When getAdjForm(); is called from getTerritories(),
   the $('territory').value !==  seems to be the problem. Does the
   browser not know that was an element because it just appeared?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Prototype and forms

2009-06-17 Thread Alex McAuley

Because the contents are from an AJAX request and they dont exist in the 
DOM probably .
OR..

They are outside the /form tag 

Paste full code to a pastie and we can help



- Original Message - 
From: anthony mrsmi...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Wednesday, June 17, 2009 4:52 PM
Subject: [Proto-Scripty] Re: Prototype and forms



Ok, I have found a better way to explain this.

var params = $('createAdjForm').serialize();
alert(params);

This does not show the form elements that were included via: div
id=territories/div

Why is that the case?


On Jun 17, 9:06 am, anthony mrsmi...@gmail.com wrote:
 Thanks for the cleanup. I have made those changes. Feel free to post
 others. The problem I have is that the form had two dynamic places:

 div id=territories/div
 and
 div id=adjForm/div

 There is an onChange that calls the javascript function getTerritories
 () allows the
 div id=territories/div to display which has a form element
 called territory. At the end of the same function, it calls the other
 javascript function getAdjForm(). getAdjForm() looks to see if the
 form element territory exists. That's the problem, for some reason, it
 cannot see it. What can I do to make it where it does not fail the if
 statement in that function?

 On Jun 16, 11:33 am, Rick Waldron waldron.r...@gmail.com wrote:

  A few things...

  var params = Form.serialize($('createAdjForm'));

  You can clean this up as:

  var params = $('createAdjForm').serialize();

  There are other points that you could optimize, but thats not your
  question...

  And at whatever point you want adjForm to appear, you need to add:

  $('adjForm').show()

  Rick

  On Mon, Jun 15, 2009 at 5:46 PM, anthony mrsmi...@gmail.com wrote:

   I have a form that when a user selects something from a drop-down,
   another element in the form appears. There is another piece of the
   form, that is never showing up, I need to understand what I am doing
   wrong and how to fix it:

   script type=text/javascript language=JavaScript
   function getAdjForm() {

   var params = Form.serialize($('createAdjForm'));
   alert($('territory').value);

   if ($('adjType').value !==   $('territory').value !== ){

   new Ajax.Updater(
   adjForm,
   ?= $this-url(array('controller'='index',
   'action'='get-adj-
   form'))?,
   {method:'post',
   parameters: params});
   }
   }

   function getTerritories() {

   var params = Form.serialize($('createAdjForm'));
   new Ajax.Updater(
   territories,
   ?= $this-url(array('controller'='index', 'action'='get-
   territories'))?,
   {method:'post',
   parameters: params});

   if ($('adjType').value !== ){
   //alert('d');
   getAdjForm();
   }
   }

   function getCustomer() {

   var params = Form.serialize($('createAdjForm'));
   new Ajax.Updater(
   customer,
   ?= $this-url(array('controller'='index', 'action'='get-
   customer'))?,
   {method:'post',
   parameters: params});
   }

   /script

   form method=POST id=createAdjForm action=
   p

   table border=0 CELLSPACING=10
   tr
   td
   bSelect Adjustment Type/b
   /td
   td
   ?php echo $this-formSelect('adjType',
   $this-adjType, array
   (onChange=getAdjForm()), array(=Select an Adjustment Type) +
   $this-adjTypes) ?
   /td
   /tr
   tr
   td
   bSubmitting Territory/b
   /td
   td
   ?php echo $this-formSelect('shortTerritory',
   $this-
   shortTerritory, array(onChange=getTerritories()), array
   (=Select a Territory) + $this-shortTerritories) ?
   div id=territories/div
   /td
   /tr
   tr
   td valign=top
   bJustification/b
   /td
   td
   ?php echo
   $this-formTextarea('justification',$this-
   justification,array(rows=5,cols=75)) ?
   /td
   /tr
   /table
   hr
   div id=adjForm
   /div

   ***
   This issue is that the data that should be here:
   div id=adjForm
   /div
   Is never showing. When getAdjForm(); is called from getTerritories(),
   the $('territory').value !==  seems to be the problem. Does the
   browser not know that was an element because it just appeared?



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Prototype and forms

2009-06-17 Thread anthony

Here was the problem.

I should have been calling the function (getAdjForm) using onComplete:

function getTerritories() {

var params = $('createAdjForm').serialize();
new Ajax.Updater(
territories,
?= $this-url(array('controller'='index', 'action'='get-
territories'))?,
{method:'post',
parameters: params,
onComplete: getAdjForm});
}

I have a lot to learn.

On Jun 17, 10:54 am, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 Because the contents are from an AJAX request and they dont exist in the
 DOM probably .
 OR..

 They are outside the /form tag 

 Paste full code to a pastie and we can help

 - Original Message -
 From: anthony mrsmi...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Wednesday, June 17, 2009 4:52 PM
 Subject: [Proto-Scripty] Re: Prototype and forms

 Ok, I have found a better way to explain this.

 var params = $('createAdjForm').serialize();
 alert(params);

 This does not show the form elements that were included via: div
 id=territories/div

 Why is that the case?

 On Jun 17, 9:06 am, anthony mrsmi...@gmail.com wrote:
  Thanks for the cleanup. I have made those changes. Feel free to post
  others. The problem I have is that the form had two dynamic places:

  div id=territories/div
  and
  div id=adjForm/div

  There is an onChange that calls the javascript function getTerritories
  () allows the
  div id=territories/div to display which has a form element
  called territory. At the end of the same function, it calls the other
  javascript function getAdjForm(). getAdjForm() looks to see if the
  form element territory exists. That's the problem, for some reason, it
  cannot see it. What can I do to make it where it does not fail the if
  statement in that function?

  On Jun 16, 11:33 am, Rick Waldron waldron.r...@gmail.com wrote:

   A few things...

   var params = Form.serialize($('createAdjForm'));

   You can clean this up as:

   var params = $('createAdjForm').serialize();

   There are other points that you could optimize, but thats not your
   question...

   And at whatever point you want adjForm to appear, you need to add:

   $('adjForm').show()

   Rick

   On Mon, Jun 15, 2009 at 5:46 PM, anthony mrsmi...@gmail.com wrote:

I have a form that when a user selects something from a drop-down,
another element in the form appears. There is another piece of the
form, that is never showing up, I need to understand what I am doing
wrong and how to fix it:

script type=text/javascript language=JavaScript
function getAdjForm() {

var params = Form.serialize($('createAdjForm'));
alert($('territory').value);

if ($('adjType').value !==   $('territory').value !== ){

new Ajax.Updater(
adjForm,
?= $this-url(array('controller'='index',
'action'='get-adj-
form'))?,
{method:'post',
parameters: params});
}
}

function getTerritories() {

var params = Form.serialize($('createAdjForm'));
new Ajax.Updater(
territories,
?= $this-url(array('controller'='index', 'action'='get-
territories'))?,
{method:'post',
parameters: params});

if ($('adjType').value !== ){
//alert('d');
getAdjForm();
}
}

function getCustomer() {

var params = Form.serialize($('createAdjForm'));
new Ajax.Updater(
customer,
?= $this-url(array('controller'='index', 'action'='get-
customer'))?,
{method:'post',
parameters: params});
}

/script

form method=POST id=createAdjForm action=
p

table border=0 CELLSPACING=10
tr
td
bSelect Adjustment Type/b
/td
td
?php echo $this-formSelect('adjType',
$this-adjType, array
(onChange=getAdjForm()), array(=Select an Adjustment Type) +
$this-adjTypes) ?
/td
/tr
tr
td
bSubmitting Territory/b
/td
td
?php echo $this-formSelect('shortTerritory',
$this-
shortTerritory, array(onChange=getTerritories()), array
(=Select a Territory) + $this-shortTerritories) ?
div id=territories/div
/td
/tr
tr
td valign=top
bJustification/b
/td
td
?php echo
$this-formTextarea('justification',$this-
justification,array(rows=5,cols=75)) ?
/td
/tr
/table
hr
div id=adjForm
/div

***
This issue is that the data that should be here:
div id=adjForm
/div
Is never showing. When getAdjForm(); is called from getTerritories(),
the $('territory').value !==  seems to be the problem. Does the
browser not know that was an element because it just appeared?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from

[Proto-Scripty] Re: Prototype and forms

2009-06-17 Thread Rick Waldron
Always nice to find your own mistakes and learn from them - well done!


On Wed, Jun 17, 2009 at 12:30 PM, anthony mrsmi...@gmail.com wrote:


 Here was the problem.

 I should have been calling the function (getAdjForm) using onComplete:

 function getTerritories() {

var params = $('createAdjForm').serialize();
 new Ajax.Updater(
territories,
?= $this-url(array('controller'='index', 'action'='get-
 territories'))?,
{method:'post',
 parameters: params,
onComplete: getAdjForm});
 }

 I have a lot to learn.

 On Jun 17, 10:54 am, Alex McAuley webmas...@thecarmarketplace.com
 wrote:
  Because the contents are from an AJAX request and they dont exist in the
  DOM probably .
  OR..
 
  They are outside the /form tag 
 
  Paste full code to a pastie and we can help
 
  - Original Message -
  From: anthony mrsmi...@gmail.com
  To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
  Sent: Wednesday, June 17, 2009 4:52 PM
  Subject: [Proto-Scripty] Re: Prototype and forms
 
  Ok, I have found a better way to explain this.
 
  var params = $('createAdjForm').serialize();
  alert(params);
 
  This does not show the form elements that were included via: div
  id=territories/div
 
  Why is that the case?
 
  On Jun 17, 9:06 am, anthony mrsmi...@gmail.com wrote:
   Thanks for the cleanup. I have made those changes. Feel free to post
   others. The problem I have is that the form had two dynamic places:
 
   div id=territories/div
   and
   div id=adjForm/div
 
   There is an onChange that calls the javascript function getTerritories
   () allows the
   div id=territories/div to display which has a form element
   called territory. At the end of the same function, it calls the other
   javascript function getAdjForm(). getAdjForm() looks to see if the
   form element territory exists. That's the problem, for some reason, it
   cannot see it. What can I do to make it where it does not fail the if
   statement in that function?
 
   On Jun 16, 11:33 am, Rick Waldron waldron.r...@gmail.com wrote:
 
A few things...
 
var params = Form.serialize($('createAdjForm'));
 
You can clean this up as:
 
var params = $('createAdjForm').serialize();
 
There are other points that you could optimize, but thats not your
question...
 
And at whatever point you want adjForm to appear, you need to add:
 
$('adjForm').show()
 
Rick
 
On Mon, Jun 15, 2009 at 5:46 PM, anthony mrsmi...@gmail.com wrote:
 
 I have a form that when a user selects something from a drop-down,
 another element in the form appears. There is another piece of the
 form, that is never showing up, I need to understand what I am
 doing
 wrong and how to fix it:
 
 script type=text/javascript language=JavaScript
 function getAdjForm() {
 
 var params = Form.serialize($('createAdjForm'));
 alert($('territory').value);
 
 if ($('adjType').value !==   $('territory').value !== ){
 
 new Ajax.Updater(
 adjForm,
 ?= $this-url(array('controller'='index',
 'action'='get-adj-
 form'))?,
 {method:'post',
 parameters: params});
 }
 }
 
 function getTerritories() {
 
 var params = Form.serialize($('createAdjForm'));
 new Ajax.Updater(
 territories,
 ?= $this-url(array('controller'='index', 'action'='get-
 territories'))?,
 {method:'post',
 parameters: params});
 
 if ($('adjType').value !== ){
 //alert('d');
 getAdjForm();
 }
 }
 
 function getCustomer() {
 
 var params = Form.serialize($('createAdjForm'));
 new Ajax.Updater(
 customer,
 ?= $this-url(array('controller'='index', 'action'='get-
 customer'))?,
 {method:'post',
 parameters: params});
 }
 
 /script
 
 form method=POST id=createAdjForm action=
 p
 
 table border=0 CELLSPACING=10
 tr
 td
 bSelect Adjustment Type/b
 /td
 td
 ?php echo $this-formSelect('adjType',
 $this-adjType, array
 (onChange=getAdjForm()), array(=Select an Adjustment
 Type) +
 $this-adjTypes) ?
 /td
 /tr
 tr
 td
 bSubmitting Territory/b
 /td
 td
 ?php echo $this-formSelect('shortTerritory',
 $this-
 shortTerritory, array(onChange=getTerritories()), array
 (=Select a Territory) + $this-shortTerritories) ?
 div id=territories/div
 /td
 /tr
 tr
 td valign=top
 bJustification/b
 /td
 td
 ?php echo
 $this-formTextarea('justification',$this-
 justification,array(rows=5,cols=75)) ?
 /td
 /tr
 /table
 hr
 div id=adjForm
 /div
 
 ***
 This issue is that the data that should be here:
 div id=adjForm
 /div
 Is never showing. When getAdjForm(); is called from
 getTerritories(),
 the $('territory').value !==  seems to be the problem. Does the
 browser

[Proto-Scripty] Re: Prototype and forms

2009-06-17 Thread Alex McAuley

Maybe add it on onSuccess too ! just to be safe!
- Original Message - 
From: anthony mrsmi...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Wednesday, June 17, 2009 5:30 PM
Subject: [Proto-Scripty] Re: Prototype and forms



Here was the problem.

I should have been calling the function (getAdjForm) using onComplete:

function getTerritories() {

var params = $('createAdjForm').serialize();
new Ajax.Updater(
territories,
?= $this-url(array('controller'='index', 'action'='get-
territories'))?,
{method:'post',
parameters: params,
onComplete: getAdjForm});
}

I have a lot to learn.

On Jun 17, 10:54 am, Alex McAuley webmas...@thecarmarketplace.com
wrote:
 Because the contents are from an AJAX request and they dont exist in the
 DOM probably .
 OR..

 They are outside the /form tag 

 Paste full code to a pastie and we can help

 - Original Message -
 From: anthony mrsmi...@gmail.com
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Sent: Wednesday, June 17, 2009 4:52 PM
 Subject: [Proto-Scripty] Re: Prototype and forms

 Ok, I have found a better way to explain this.

 var params = $('createAdjForm').serialize();
 alert(params);

 This does not show the form elements that were included via: div
 id=territories/div

 Why is that the case?

 On Jun 17, 9:06 am, anthony mrsmi...@gmail.com wrote:
  Thanks for the cleanup. I have made those changes. Feel free to post
  others. The problem I have is that the form had two dynamic places:

  div id=territories/div
  and
  div id=adjForm/div

  There is an onChange that calls the javascript function getTerritories
  () allows the
  div id=territories/div to display which has a form element
  called territory. At the end of the same function, it calls the other
  javascript function getAdjForm(). getAdjForm() looks to see if the
  form element territory exists. That's the problem, for some reason, it
  cannot see it. What can I do to make it where it does not fail the if
  statement in that function?

  On Jun 16, 11:33 am, Rick Waldron waldron.r...@gmail.com wrote:

   A few things...

   var params = Form.serialize($('createAdjForm'));

   You can clean this up as:

   var params = $('createAdjForm').serialize();

   There are other points that you could optimize, but thats not your
   question...

   And at whatever point you want adjForm to appear, you need to add:

   $('adjForm').show()

   Rick

   On Mon, Jun 15, 2009 at 5:46 PM, anthony mrsmi...@gmail.com wrote:

I have a form that when a user selects something from a drop-down,
another element in the form appears. There is another piece of the
form, that is never showing up, I need to understand what I am doing
wrong and how to fix it:

script type=text/javascript language=JavaScript
function getAdjForm() {

var params = Form.serialize($('createAdjForm'));
alert($('territory').value);

if ($('adjType').value !==   $('territory').value !== ){

new Ajax.Updater(
adjForm,
?= $this-url(array('controller'='index',
'action'='get-adj-
form'))?,
{method:'post',
parameters: params});
}
}

function getTerritories() {

var params = Form.serialize($('createAdjForm'));
new Ajax.Updater(
territories,
?= $this-url(array('controller'='index', 'action'='get-
territories'))?,
{method:'post',
parameters: params});

if ($('adjType').value !== ){
//alert('d');
getAdjForm();
}
}

function getCustomer() {

var params = Form.serialize($('createAdjForm'));
new Ajax.Updater(
customer,
?= $this-url(array('controller'='index', 'action'='get-
customer'))?,
{method:'post',
parameters: params});
}

/script

form method=POST id=createAdjForm action=
p

table border=0 CELLSPACING=10
tr
td
bSelect Adjustment Type/b
/td
td
?php echo $this-formSelect('adjType',
$this-adjType, array
(onChange=getAdjForm()), array(=Select an Adjustment Type) 
+
$this-adjTypes) ?
/td
/tr
tr
td
bSubmitting Territory/b
/td
td
?php echo $this-formSelect('shortTerritory',
$this-
shortTerritory, array(onChange=getTerritories()), array
(=Select a Territory) + $this-shortTerritories) ?
div id=territories/div
/td
/tr
tr
td valign=top
bJustification/b
/td
td
?php echo
$this-formTextarea('justification',$this-
justification,array(rows=5,cols=75)) ?
/td
/tr
/table
hr
div id=adjForm
/div

***
This issue is that the data that should be here:
div id=adjForm
/div
Is never showing. When getAdjForm(); is called from 
getTerritories(),
the $('territory').value !==  seems to be the problem. Does the
browser not know that was an element because it just appeared

[Proto-Scripty] Re: Prototype and forms

2009-06-16 Thread Rick Waldron
A few things...


 var params = Form.serialize($('createAdjForm'));

You can clean this up as:

 var params = $('createAdjForm').serialize();

There are other points that you could optimize, but thats not your
question...


And at whatever point you want adjForm to appear, you need to add:

$('adjForm').show()


Rick


On Mon, Jun 15, 2009 at 5:46 PM, anthony mrsmi...@gmail.com wrote:


 I have a form that when a user selects something from a drop-down,
 another element in the form appears. There is another piece of the
 form, that is never showing up, I need to understand what I am doing
 wrong and how to fix it:

 script type=text/javascript language=JavaScript
 function getAdjForm() {

   var params = Form.serialize($('createAdjForm'));
 alert($('territory').value);

if ($('adjType').value !==   $('territory').value !== ){

new Ajax.Updater(
adjForm,
?= $this-url(array('controller'='index',
 'action'='get-adj-
 form'))?,
{method:'post',
parameters: params});
}
 }

 function getTerritories() {

var params = Form.serialize($('createAdjForm'));
new Ajax.Updater(
territories,
?= $this-url(array('controller'='index', 'action'='get-
 territories'))?,
{method:'post',
parameters: params});

if ($('adjType').value !== ){
//alert('d');
getAdjForm();
}
 }

 function getCustomer() {

var params = Form.serialize($('createAdjForm'));
new Ajax.Updater(
customer,
?= $this-url(array('controller'='index', 'action'='get-
 customer'))?,
{method:'post',
parameters: params});
 }

 /script

 form method=POST id=createAdjForm action=
 p

 table border=0 CELLSPACING=10
tr
td
bSelect Adjustment Type/b
/td
td
?php echo $this-formSelect('adjType',
 $this-adjType, array
 (onChange=getAdjForm()), array(=Select an Adjustment Type) +
 $this-adjTypes) ?
/td
/tr
tr
td
bSubmitting Territory/b
/td
td
?php echo $this-formSelect('shortTerritory',
 $this-
 shortTerritory, array(onChange=getTerritories()), array
 (=Select a Territory) + $this-shortTerritories) ?
div id=territories/div
/td
/tr
tr
td valign=top
bJustification/b
/td
td
?php echo
 $this-formTextarea('justification',$this-
 justification,array(rows=5,cols=75)) ?
/td
/tr
 /table
 hr
 div id=adjForm
 /div


 ***
 This issue is that the data that should be here:
 div id=adjForm
 /div
 Is never showing. When getAdjForm(); is called from getTerritories(),
 the $('territory').value !==  seems to be the problem. Does the
 browser not know that was an element because it just appeared?

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---