[Proto-Scripty] Re: how to pass question marks in fields using ajax updater

2010-01-29 Thread Tami
Here's what worked.

I did this:

var url = 'site.lasso?fuseaction=ajax.famMbr_nestedForm';
var target = 'ajax_famMbr_div';
 var myAjax = new Ajax.Updater(target, url, {method:'get',
parameters: {a: $F('member_nm'), b: $F('member_address'), c: $F
('member_ph'), d: $F('member_email'), e: $F('date_member_birth'), f: $F
('member_sex'), g: $F('member_ethnicity'), btn: $F
('AddBtn_famMbr')} });


Instead of doing this:

var url = 'site.lasso?fuseaction=ajax.famMbr_nestedForm';

var pars = 'a='+escape($F('member_nm')) +  'b='+escape($F
('member_address'))  + 'c='+escape($F('member_ph'))  + 'd='+escape($F
('member_email')) + 'e='+escape($F('date_member_birth'))  +
'f='+escape($F('member_sex'))  + 'g='+escape($F('member_ethnicity'))
+ 'btn=' + document.getElementById('AddBtn_famMbr').value;

var target = 'ajax_famMbr_div';
 var myAjax = new Ajax.Updater(target, url, {method:'get',
parameters:pars});

-- 
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-scriptacul...@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: how to pass question marks in fields using ajax updater

2010-01-27 Thread T.J. Crowder
Hi,

You're doing a lot more work there than you need to (and apparently
introducing some problem with a question mark; I'm not immediately
seeing why, but I think your message was truncated).

Check out Form#serialize and Form.Element#serialize. There's no
problem submitting fields with question marks.

http://api.prototypejs.org/dom/form.html#serialize-class_method
http://api.prototypejs.org/dom/form.html#serializeelements-class_method
http://api.prototypejs.org/dom/form/element.html#serialize-class_method

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com


On Jan 26, 10:01 pm, Tami t...@asktami.com wrote:
 I'm trying to do this (see below) and IF a field has a question mark
 in it then nothing is passed - an EMPTY field is submitted.

 How do I let users enter question marks in the fields on my nested
 form?   Fields are member_nm, member_address, etc.

 Thanks in advance.

 function ajax_Add_famMbr() {

 // alert('member_nm = ' + document.getElementById('member_nm').value +
 ' member_address = ' + document.getElementById('member_address').value
 + ' member_ph = '  + document.getElementById('member_ph').value  + '
 member_email = ' + document.getElementById('member_email').value + '
 date_member_birth = ' + document.getElementById
 ('date_member_birth').value +  ' member_sex = ' +
 document.getElementById('member_sex').value + ' member_ethnicity = '
 +  document.getElementById('member_ethnicity').value + ' btn = ' +
 document.getElementById('AddBtn_famMbr').value) ;

   if (document.getElementById('member_nm').value  == ''){
   alert('Member name is required.');
                         return false;
    }

          var url = 'site.lasso?fuseaction=ajax.famMbr_nestedForm';
          var pars = 'a='+document.getElementById('member_nm').value +
 'b='+escape($F('member_address'))  + 'c='+escape($F('member_ph'))  +
 'd='+escape($F('member_email')) + 'e='+escape($F
 ('date_member_birth'))  + 'f='+escape($F('member_sex'))  +
 'g='+escape($F('member_ethnicity')) + 'btn=' +
 document.getElementById('AddBtn_famMbr').value;
          var target = 'ajax_famMbr_div';
          var myAjax = new Ajax.Updater(target, url, {method:'get',
 parameters:pars});
          // reset add form
          document.famMbr.member_nm.value='';
          document.famMbr.member_address.value='';
          document.famMbr.member_ph.value='';
          document.famMbr.member_email.value='';
          document.famMbr.date_member_birth.value='';
          document.famMbr.member_sex.value='';
          document.famMbr.member_ethni

-- 
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-scriptacul...@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: how to pass question marks in fields using ajax updater

2010-01-27 Thread Scott
It looks like you are forming your parameters as you would a
querystring
ex: a=appleb=banana

parameters for an Ajax.Updater or Request are usually set up like
this:
parameters: { a: 'apple', b: 'banana' }

if you are still having trouble passing in a '?' you could also try
changing the method to 'post'



On Jan 27, 12:02 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 You're doing a lot more work there than you need to (and apparently
 introducing some problem with a question mark; I'm not immediately
 seeing why, but I think your message was truncated).

 Check out Form#serialize and Form.Element#serialize. There's no
 problem submitting fields with question marks.

 http://api.prototypejs.org/dom/form.html#serialize-class_methodhttp://api.prototypejs.org/dom/form.html#serializeelements-class_methodhttp://api.prototypejs.org/dom/form/element.html#serialize-class_method

 HTH,
 --
 T.J. Crowder
 Independent Software Consultant
 tj / crowder software / comwww.crowdersoftware.com

 On Jan 26, 10:01 pm, Tami t...@asktami.com wrote:



  I'm trying to do this (see below) and IF a field has a question mark
  in it then nothing is passed - an EMPTY field is submitted.

  How do I let users enter question marks in the fields on my nested
  form?   Fields are member_nm, member_address, etc.

  Thanks in advance.

  function ajax_Add_famMbr() {

  // alert('member_nm = ' + document.getElementById('member_nm').value +
  ' member_address = ' + document.getElementById('member_address').value
  + ' member_ph = '  + document.getElementById('member_ph').value  + '
  member_email = ' + document.getElementById('member_email').value + '
  date_member_birth = ' + document.getElementById
  ('date_member_birth').value +  ' member_sex = ' +
  document.getElementById('member_sex').value + ' member_ethnicity = '
  +  document.getElementById('member_ethnicity').value + ' btn = ' +
  document.getElementById('AddBtn_famMbr').value) ;

    if (document.getElementById('member_nm').value  == ''){
    alert('Member name is required.');
                          return false;
     }

           var url = 'site.lasso?fuseaction=ajax.famMbr_nestedForm';
           var pars = 'a='+document.getElementById('member_nm').value +
  'b='+escape($F('member_address'))  + 'c='+escape($F('member_ph'))  +
  'd='+escape($F('member_email')) + 'e='+escape($F
  ('date_member_birth'))  + 'f='+escape($F('member_sex'))  +
  'g='+escape($F('member_ethnicity')) + 'btn=' +
  document.getElementById('AddBtn_famMbr').value;
           var target = 'ajax_famMbr_div';
           var myAjax = new Ajax.Updater(target, url, {method:'get',
  parameters:pars});
           // reset add form
           document.famMbr.member_nm.value='';
           document.famMbr.member_address.value='';
           document.famMbr.member_ph.value='';
           document.famMbr.member_email.value='';
           document.famMbr.date_member_birth.value='';
           document.famMbr.member_sex.value='';
           document.famMbr.member_ethni

-- 
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-scriptacul...@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.