[Proto-Scripty] Re: location.hash and event handler/window event

2008-10-10 Thread MikeFeltman

I'm doing this with a period executer and it seems to work great.

// Monitor the hash in case the user clicked the back button.
new PeriodicalExecuter(function(pe) {
var lcDocument = window.location.hash;
if (lcDocument.length>1) {
// updateContent sets document.F1CMSContentId to the document 
id.
if (document.F1CMSContentId !== lcDocument.substring(1)) {
F1.UI.UpdateContent(lcDocument.substring(1));
}
}
}, .5);


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: prototype and iframe

2008-10-10 Thread Diodeus

You don't use AJAX to put content into an Iframe. An Iframe is a new
separate document.

Use:

$("iframe_show).src="http://";

On Oct 10, 1:17 pm, "Miguel Beltran R." <[EMAIL PROTECTED]> wrote:
> Hi list
>
> I have the next code but not work, iframe show nothing
> what I doing wrong?
>
> 
> ...
> 
> 
>
>   ...
>
>
>   
>
> 
> 
> var muestra = function(m_id, m_modulo, m_modo){
> var element =  $(m_id);
> element.update('cargando...');
> new Ajax.Updater(element,
>  'muestra.html', {
>  method: 'get',
>  parameters: {modulo:m_modulo, modo:m_modo}
>  });
>   }
> document.observe('dom:loaded', function(){
>muestra('iframe_show', 'taller_busca', 'nada');}
>
> 
> 
> 
>
> --
> 
> Lo bueno de vivir un dia mas
> es saber que nos queda un dia menos de vida
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Observe on Script Elements

2008-10-10 Thread Diodeus

Do it the other way around: have the loaded script announce itself
once it has loaded by putting a function call in it.

On Oct 10, 2:37 pm, webbear1000 <[EMAIL PROTECTED]> wrote:
> Hey peeps
>
> I've got this pretty knotty problem.
>
> I'm loading js files on demand by generating them and appending them
> to the head element.
>
> What I'm also doing is binding a passed function to the script tag for
> it's load event which enables me to call in a js file and work on it
> when I know it's loaded.
>
> I hope that makes sense.
>
> The problem is IE (of course). It doesn't seem to call the load event.
> Anybody done something similar and managed to work around the problem?
>
> Thanks guys and gals
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Observe on Script Elements

2008-10-10 Thread webbear1000

Hey peeps

I've got this pretty knotty problem.

I'm loading js files on demand by generating them and appending them
to the head element.

What I'm also doing is binding a passed function to the script tag for
it's load event which enables me to call in a js file and work on it
when I know it's loaded.

I hope that makes sense.

The problem is IE (of course). It doesn't seem to call the load event.
Anybody done something similar and managed to work around the problem?

Thanks guys and gals
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: help submitting a form which serves a file

2008-10-10 Thread Brian Williams

On Fri, Oct 10, 2008 at 9:03 AM, spectrus <[EMAIL PROTECTED]> wrote:
>
> Laurent,
>
> Yes, it does indeed work with a flat submit, thank you very much for
> the tip. The thing is, I was hoping that somehow I would be able to
> get the PDF download starting, with optionally getting some data back
> for a callback in case something fails and I do get JSON as a
> response, which is impossible if I do a flat submit (am I wrong?). I
> guess you can't have your cake and eat it too.

unless i am missing something you won't be able to feed to the same
browser instance two different things - application/pdf and text/html
without using a response handler to parse some kind of response from
the server (prolly json would be easiest) with a textual response and
then a hidden iframe that you can redirect to a link provided in the
json.

>
> Brian,
>
> Thank you for the Apache directive! Nice tip, although unfortunately I
> am in an environment where I can't rely on Apache directives, since I
> don't control that. Yes, I don't need AJAX to feed a file to the user,
> but as I mentioned above, I would love to have it in case something
> fails - in that case I can let the user know that something went
> wrong. Perhaps there's a way to do that which I can't see?..

see above

>
> We are using FPDF (http://www.fpdf.org/), which is free and suits our
> needs pretty well (generating two types of rather simple reports, as
> well as an invoice). Anything better out there?
>
> Best regards,
> Max

yes, something that is much more up to date (and actually still in
development) which is based on FPDF and is free
http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf



>
>
> On Oct 9, 5:34 pm, "Brian Williams" <[EMAIL PROTECTED]> wrote:
>> I have been working like mad with PDFs built dynamically with PHP the last 
>> week.
>>
>> One thing to be *absolutely* sure of is that you do not have ANY
>> output before the PDF download starts.
>>
>> If you have Apache2 with mod_header loaded, there is a FilesMatch
>> directive to always force a download for a PDF
>>
>> 
>>   ForceType application/octet-stream
>>   Header set Content-Disposition attachment
>> 
>>
>> On a side note, you do not need AJAX for this feature to feed the user
>> a PDF file for download just set the form action to empty (same page)
>> and it should leave the page/browser right where it is with the form
>> still filled out, unless you are trying to feed a PDF to a div... you
>> aren't are you?
>>
>> by the by which PDF library did you use to generate with?
>>
>> On Thu, Oct 9, 2008 at 5:24 PM, lfortin <[EMAIL PROTECTED]> wrote:
>>
>> > Hi Max,
>>
>> > Using Form#request with a form performs an Ajax.Request, using the
>> > inputs of the form as serialized parameters.
>> > This might not bring you the behavior you expect to have.
>>
>> > Maybe if you simply do a flat form submit, using $
>> > ('form_pdf').submit(); with all its inputs(hidden, text, ...) pre-
>> > filled:
>>
>> > 
>> > 
>> > 
>> > ...
>> > 
>>
>> > hope it helps,
>>
>> > -Laurent
>>
>> > On Oct 9, 3:14 pm, spectrus <[EMAIL PROTECTED]> wrote:
>> >> Hello,
>>
>> >> I am trying to submit a form that calls PHP which generates a PDF file
>> >> and shoots it back to the user. When I do it using GET directly in the
>> >> browser address bar it works. However when I submit the form with
>> >> Prototype (either POST or GET) it doesn't:
>>
>> >> $('form_pdf').request({ parameters: params });
>>
>> >> I see the response headers in firebug set correctly as '
>> >> application/x-
>> >> download' (which are set in the back-end). Furthermore, the response
>> >> tab in the firebug console shows the actual contents of the PDF file
>> >> (flat-text gibberish).
>>
>> >> It must be something trivial, perhaps setting some parameter for the
>> >> request method. Does Prototype somehow override the headers when it
>> >> receives responses to its AJAX requests?
>>
>> >> If anyone has ever dealt with a similar issue, any pointers are
>> >> greatly appreciated.
>>
>> >> Regards,
>> >> Max
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Scriptaculous - Sound.play problem

2008-10-10 Thread Doug

Yes, I've tried "audio/wav" and "audio/x-wav".  Neither work.  I can
see that it actually downloads the file, but it never gets played.

Thanks for the help.

Doug
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] prototype and iframe

2008-10-10 Thread Miguel Beltran R.
Hi list

I have the next code but not work, iframe show nothing
what I doing wrong?


...


   
  ...
   
   
  
   


var muestra = function(m_id, m_modulo, m_modo){
var element =  $(m_id);
element.update('cargando...');
new Ajax.Updater(element,
 'muestra.html', {
 method: 'get',
 parameters: {modulo:m_modulo, modo:m_modo}
 });
  }
document.observe('dom:loaded', function(){
   muestra('iframe_show', 'taller_busca', 'nada');
}







-- 

Lo bueno de vivir un dia mas
es saber que nos queda un dia menos de vida

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: prototype and iframe

2008-10-10 Thread Matt Foster

Ditch the iframe object in favor of a DIV and things will work much
smoother..



On Oct 10, 12:17 pm, "Miguel Beltran R." <[EMAIL PROTECTED]> wrote:
> Hi list
>
> I have the next code but not work, iframe show nothing
> what I doing wrong?
>
> 
> ...
> 
> 
>    
>       ...
>    
>    
>       
>    
> 
> 
> var muestra = function(m_id, m_modulo, m_modo){
>     var element =  $(m_id);
>     element.update('cargando...');
>     new Ajax.Updater(element,
>              'muestra.html', {
>              method: 'get',
>              parameters: {modulo:m_modulo, modo:m_modo}
>              });
>   }
> document.observe('dom:loaded', function(){
>    muestra('iframe_show', 'taller_busca', 'nada');}
>
> 
> 
> 
>
> --
> 
> Lo bueno de vivir un dia mas
> es saber que nos queda un dia menos de vida
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Can I use onkeydown with invoke?

2008-10-10 Thread Edward Grant

> Basically, I want to limit all the input field with 'info' class to
> allow only alphabets, number , backspace and space with a custom
> function.

I have had good luck using http://www.livevalidation.com It might be
more than you want but is great for making validations readable for
when you com back to the code later.


-- 
Edward Grant
[EMAIL PROTECTED]

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Dealing with JSON

2008-10-10 Thread T.J. Crowder

@Darrin:

Assuming the OP's 'errors' object only contains entries for fields
with errors (and not for fields that were okay), we'll need to be sure
to clear their 'error' elements to blank just in case they've been set
before.

@Ben:

Just FWIW, I'd shy away from using a dot (.) in your element IDs, so
old people like me don't mistake things for CSS selectors involving a
class name at first glance. :-)

I'd probably change things so that the error spans don't use dots in
their IDs, and do use a class (like, say, 'flderr' for "field
error").  E.g.:




Then I'd use element.select() on the containing form element to find
the error spans, loop through them, and set the message on each either
to blank or to the error:

function displayErrors(errors)
{
$('example').select('.flderr').each(function(span) {
// This ID check is just me being paranoid
if (span.id.substring(0, 4) == 'err_') {
span.innerHTML = errors[span.id.substring(4)] || '';
}
});
}

(Edge case: If there are errors for which there are no error spans,
the above won't show them anywhere.)

Alternately, there's probably a clever way to do this without giving
the error spans IDs at all using Element.previous, but for me that
starts getting awfully finicky about the structure of the HTML.  I'd
stick to using IDs for robustness and simplicity.

FWIW,
--
T.J. Crowder
tj / crowder software / com

On Oct 10, 1:37 pm, darrinholst <[EMAIL PROTECTED]> wrote:
> How about something like
>
> $H(errors).each(function(pair) {
>   $(pair.key + '.error').update(pair.value);
>
> });
>
> On Oct 10, 3:09 am, Ben Short <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I have a simple page that submits a form via Ajax. If I leave both
> > fields blank i get the following response in JSON from the server.
>
> > {"errors":{"lastName":"Required","firstName":"Required"}}
>
> > I have coded the js to check for errors and then update the page based
> > on them.
>
> > What I would like to do is iterate over the errors returned rather
> > than have to hard code each error check. So i could use the lastName
> > and firstName from the JSON, then append '.error' and use the
> > firstName.error to lookup the span to then set the error message in.
>
> > Is this possible?
>
> > Below is my html page.
>
> >  >         "http://www.w3.org/TR/html4/loose.dtd";>
> > 
> > 
> >     
>
> >      > script>
>
> >