views:

95

answers:

5

I have 4 elements in my form. Usually, when submitting the form you would get this in the url:index.html?day=01&month=01&year=1999&reporter=Joe+Blogs However, in my interface, users are switching between the date picker and the person picker. Is it possible to only send the values on the select that is active?

[I started writing this to post to you guys but then I had a thought and checked out the disabled attribute of form elements - so in the spirit of stack over flow I have entered my own answer too]

+1  A: 

Use the .attr("disabled","disabled") in jQuery.

Daniel
A: 

Why you disable this in javascript though?

You should make a server-side decision anyway, what if server gets the both person and date parameters (e.g. someone who has javascript disabled or just jquery blocked...)

kender
A: 

You could put the date picker and the name selection in separate forms (possibly with separate "Action=... 's).

Simple and works on any browser.

James Anderson
A: 

I would rather prefer to pass the control to the server side for any sort of validation.

andHapp
+1  A: 

yeah - after I did this I realised the problem I had created for non-js users. I have made a "todo" to break it up into two forms. I thought I was being smart by turning on and off different fieldsets (trying to use proper markup) but then, yeah, stuffed that up. Oh well, least I learned about disabled and how to manipulate it in jQuery...

Daniel