You can make it just selects like this:
if(selects[i].tagName.toUpperCase() === "SELECT" &&
selects[i].getValue() == 0){
-- T.J.
On Aug 1, 5:42 pm, Martín Marqués <[email protected]> wrote:
> OK, got it done in another way (I'm not sure if I was clear about what
> I wanted).
>
> Form id is formEntrega.
>
> Event.observe(window, 'load', function() {
> Event.observe('formEntrega', 'submit', function(event){
>
> var selects = this.getElements();
>
> for(var i=0; i < selects.length; i++){
> if(selects[i].getValue() == 0){
> selects[i].disable();
> }
> }
> this.submit();
> }
> );
>
> });
>
> This works like a charm.
>
> The only thing missing is some validation for a select element
> (getElements() brings everything in the form, not only the selects),
> but havent found how to do that.
>
> 2011/8/1 T.J. Crowder <[email protected]>:
>
>
>
>
>
>
>
>
>
> > Hi,
>
> > Sounds like some refactoring is in order.
>
> > If you're doing an Ajax call, then I'm with Miguel, you can just grab
> > the fields you really need and send them directly.
>
> > If you want it to be a real form post (refreshes the page, etc.), you
> > could create a new form on-the-fly with the relevant fields and submit
> > that instead.
>
> > Alternately, remember that browsers (and Prototype) don't send
> > disabled form fields. So if you know, when submitting, which fields
> > are relevant and don't want to refactor, just ensure that by the time
> > the form is submitted, the irrelevant fields are disabled. Then they
> > won't be sent.
>
> > But 1,300 fields in a single form...that screams "divide and conquer"
> > to me.
>
> > Best,
> > --
> > T.J. Crowder
> > Independent Software Engineer
> > tj / crowder software / com
> > www / crowder software / com
>
> > On Aug 1, 3:14 pm, Martín Marqués <[email protected]> wrote:
> >> I have a large form with quite a bunch of pull downs to select. Then a
> >> submit button.
>
> >> The thing is that there can be up to 1300 vars, and maybe more in the
> >> future, but in every post only 10 or 15 are valid for the program. How
> >> can I eliminate them from the list of variables that are finally
> >> submitted?
>
> >> --
> >> Martín Marqués
> >> select 'martin.marques' || '@' || 'gmail.com'
> >> DBA, Programador, Administrador
>
> > --
> > 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
> > [email protected].
> > To unsubscribe from this group, send email to
> > [email protected].
> > For more options, visit this group
> > athttp://groups.google.com/group/prototype-scriptaculous?hl=en.
>
> --
> Martín Marqués
> select 'martin.marques' || '@' || 'gmail.com'
> DBA, Programador, Administrador
--
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 [email protected].
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.