[Proto-Scripty] Re: Preventing Autocompleter

2010-07-05 Thread infringer
No takers?  I guess there is no way to do this?

On Jul 1, 6:51 pm, infringer infrin...@gmail.com wrote:
 I have an autocompleter on a City field.  But I don't want it to send
 the request UNLESS the state field is filled in?

 Any suggestions on how to prevent it from sending the request?  No
 need for the unnecessary requests going back and forth.

 Thanks,
 -David

-- 
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] Preventing Autocompleter

2010-07-01 Thread infringer
I have an autocompleter on a City field.  But I don't want it to send
the request UNLESS the state field is filled in?

Any suggestions on how to prevent it from sending the request?  No
need for the unnecessary requests going back and forth.

Thanks,
-David

-- 
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: Escaping Input

2009-07-31 Thread infringer

This method works well in FF 3.5, but FF 3.0.12 doesn't like it...  I
really would like to keep the from coming in a separate variable, but
realize I may have to change that.

3.0.12's POST (truncated) just for info:
%7Bstartdate%3A%202009-04-23%2C%20

3.5's POST (truncated):
%7B%22startdate%22%3A%20%222009-04-23%22%2C%


As you can see 3.5 has extra characters...

I'm sending this to PHP, and my processing script receives the JSON
variable as such

$json_string = (isset($_POST['json']) ? rawurldecode($_POST['json']) :
);
$json = json_decode($json_string, true);
if (($json == '') || empty($json) || ($json == null)) {
$result['valid_result'] = 2;
$result['reason'] = rawurlencode(Unknown error, Administrator has
been notified.  Please try again later);
$result = json_encode($result);
header(Content-Type: application/json);
print $result;
exit(0);

}

so when users are using 3.0.xx they always receive this error message,
because the PHP script doesn't see it as valid JSON.

but 3.5 users (myself only) can perform the saves/deletes, etc

This is for an internal application, we only allow FF to be used.

Thanks for the help!
-David


On Jul 30, 4:00 pm, T.J. Crowder t...@crowdersoftware.com wrote:
 Sorry, I got my wires crossed half-way through the first one of
 those.  You can't use String#toJSON, it's not a string!  Doh.
 Correcting my first example:

 entry = encodeURIComponent(Object.toJSON($('busCalForm').serialize
 (true)));
 new Ajax.Request(
     modules/buscal/processes/saveBooking.php, {
     parameters: {
         year: year,
         recnum: busmstr_id,
         json: entry
     },
     onSuccess: busCal.gotEntry.bind(this),
     onFailure: busCal.gotFailure.bind(this)

 });

 Sorry 'bout that.

 -- T.J. :-)

 On Jul 30, 8:55 pm, T.J. Crowder t...@crowdersoftware.com wrote:



  Hi,

  You're sending an unencoded string (which happens to be in JSON
  format) as part of your parameters string, which is meant to be URL-
  encoded data.  A # sign is the least of your problems. ;-)  You'll
  want to encode that with JavaScript's encodeURIComponent function[1].

  Somewhat OT, but as of 1.6 (at least), the preferred way to provide
  options to Ajax.Request is as an object.  If you give it a string,
  that string will be converted to an object, and then later converted
  back into a string.  Yes, really. :-)  Also, String has a toJSON
  function you can use instead of JSON.stringify (not that it matters).

  So:

  entry = encodeURIComponent($('busCalForm').serialize(true).toJSON());
  new Ajax.Request(
      modules/buscal/processes/saveBooking.php, {
      parameters: {
          year: year,
          recnum: busmstr_id,
          json: entry
      },
      onSuccess: busCal.gotEntry.bind(this),
      onFailure: busCal.gotFailure.bind(this)

  });
   How can I effectively escape an entire form, without
   having to get the value and escape them individually?  Is there a
   command I'm missing?

  That's not quite what your code is doing; you're sending the form
  fields as a JSON-encoded string in a parameter called json.  If you
  just want to send the form fields, and you don't need them to arrive
  at the other end as a JSON string, there's a *much* shorter way:
  Form#request[2].  Assuming that your form element has the
  saveBooking.php as its action attribute:

  $('busCalForm').request({
      parameters: {
          year: year,
          recnum: busmstr_id
      },
      onSuccess: busCal.gotEntry.bind(this),
      onFailure: busCal.gotFailure.bind(this)

  });

  The form fields will no longer be JSON-ified (but will be properly URL-
  encoded), they'll arrive as individual parameters on the request.  If
  the form field doesn't have saveBooking.php as its action and you
  can't change that, the Ajax.Request can still be simplified:

  params = $('busCalForm').serialize(true);
  params.year = year;
  params.recnum = busmstr_id;
  new Ajax.Request(
      modules/buscal/processes/saveBooking.php, {
      parameters: params,
      onSuccess: busCal.gotEntry.bind(this),
      onFailure: busCal.gotFailure.bind(this)

  });

  [1]https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global...
  [2]http://prototypejs.org/api/form/request

  HTH,
  --
  T.J. Crowder
  tj / crowder software / com
  Independent Software Engineer, consulting services available

  On Jul 30, 8:27 pm, infringer infrin...@gmail.com wrote:

   I have a form, I've been doing this in javascript:

   entry = $('busCalForm').serialize(true);
   entry = JSON.stringify(entry);
   new Ajax.Request(modules/buscal/processes/saveBooking.php, {
            parameters: year= + year + recnum= + busmstr_id + json= +
   entry,
            onSuccess: busCal.gotEntry.bind(this),
            onFailure: busCal.gotFailure.bind(this)
            });

   But i have a user that has typed a # in one of the fields, and the
   script dies.  How can I effectively escape an entire form, without

[Proto-Scripty] Escaping Input

2009-07-30 Thread infringer

I have a form, I've been doing this in javascript:

entry = $('busCalForm').serialize(true);
entry = JSON.stringify(entry);
new Ajax.Request(modules/buscal/processes/saveBooking.php, {
 parameters: year= + year + recnum= + busmstr_id + json= +
entry,
 onSuccess: busCal.gotEntry.bind(this),
 onFailure: busCal.gotFailure.bind(this)
 });

But i have a user that has typed a # in one of the fields, and the
script dies.  How can I effectively escape an entire form, without
having to get the value and escape them individually?  Is there a
command I'm missing?

-David
--~--~-~--~~~---~--~~
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] InPlaceEditor help

2009-04-29 Thread infringer

I have a div, that contains two tables.  Inside the first table I have
an InPlace Editor.

During the use of the application, the entire div can be replaced.
Thus removing the IPE.  But then the div can be replaced again, with
the default view, which should have the IPE.  When this happens, If
you click on where the inplaceeditor should be the text disappears,
but no input and buttons appear.

If I look in firebug, you can see it created the form, but it is
greyed out.

Any help will be greatly appreciated.

Thanks,
-David
--~--~-~--~~~---~--~~
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: InPlaceEditor help

2009-04-29 Thread infringer

Nevermind, I figured out what it was.  In my new code, I had a table
cell with an id, and I needed a div inside a table cell!  Because it
inserts before and an invalid table format causes the stuff to be
greyed out in firebug.

Thanks anyway,
-David

On Apr 29, 10:10 am, infringer infrin...@gmail.com wrote:
 I have a div, that contains two tables.  Inside the first table I have
 an InPlace Editor.

 During the use of the application, the entire div can be replaced.
 Thus removing the IPE.  But then the div can be replaced again, with
 the default view, which should have the IPE.  When this happens, If
 you click on where the inplaceeditor should be the text disappears,
 but no input and buttons appear.

 If I look in firebug, you can see it created the form, but it is
 greyed out.

 Any help will be greatly appreciated.

 Thanks,
 -David
--~--~-~--~~~---~--~~
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] InPlaceEditor autocomplete?

2009-04-23 Thread infringer

Does anyone know how to turn the browser's autocomplete off for the
inplaceeditor's field?

Here's my Inplaceeditor setup:

new Ajax.InPlaceEditor('dayDateNotes', '/CoachFlex/modules/buscal/
processes/updateDayDateNotes.php', {

  cancelControl: 'button',

  okText: 'Save',

  cancelText: 'Cancel',

  size: 90,

  callback: function (form, value) {

  return 'year=' + CFescape($F('busYear')) + 
'new_note='
+ CFescape(value) + 'recnum=' + CFescape($F('dayDateRecNum'));

  } 
});

but my field has alot of autocomplete entries after using it for a
while and I would like to disable it for this particular field.

Thanks in advance!
-David

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---