thanks for the reply. i was doing it wrong. this syntax worked for me
in the end:
var imgDesc = Form.getInputs(theform, 'text','imgDesc');
var imgTitle = Form.getInputs(theform, 'text','imgTitle');
but i actually realised i could do the processing i needed in php so
am not using prototype to do this.
On 14 May, 06:40, RobG <[EMAIL PROTECTED]> wrote:
> lukemack wrote:
> > hi,
>
> > i have the following function which is not working for me:
>
> > function uploadimg (theform,ajaxAction,ajaxTarget){
>
> > var imgDesc = theform.getInputs('page1', 'text','imgDesc');
>
> Try:
>
> var imgDesc = $(theform).getInputs('page1', 'text','imgDesc');
>
> I have no idea why you want to do it that way, it's very inefficient.
> What's wrong with:
>
> var imgDesc = theform.imgDesc;
>
> or
>
> var imgDesc = theform.elements['imgDesc'];
>
> to get a reference to the element directly?
>
>
>
> > alert(imgDesc[0]);
> > defaultAction=theform.action;
> > defaultTarget=theform.target;
> > theform.action=ajaxAction;
> > theform.target=ajaxTarget;
> > theform.submit(); //Submit the form.
> > //Then display a loading message to the user.
> > setStatus ("Please wait while your image uploads...","showimg");
>
> > theform.action=defaultAction;
> > theform.target=defaultTarget;
> > }
>
> > the problem i'm having is that I can't access the value of the image
> > description field in my form which looks like:
>
> > <input type="text" name="imgDesc" size="40"/>
>
> > the alert above displays 'undefined' or is just blank if i do
> > alert(imgDesc);
>
> > can anyone see what i'm doing wrong?
>
> How do you pass a reference to the form? Prototype.js extends the
> built-in form element in Firefox (and others that support element
> extensions) but not for IE - you must do it yourself. It will work if
> you change as noted above, or extend the form element before that.
> But why not just use ordinary old - theForm.elements['imgDesc'] - ?
>
> --
> Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---