Friday, July 31, 2009

[jQuery] Re: What am i doing wrong????

Like this? (Which doesn't work)

$("input[name=PlannedInvitationsOther]").focus(function(){
    $("input[name=PlannedInvitations][value=Other]").attr('checked','checked');
    }
);



On Fri, Jul 31, 2009 at 7:00 PM, FrenchiInLA <Mamali.Soheyli@gmail.com> wrote:


You should have .attr('checked','checked'), by the way you don't need to wrap
your filter by QUOTE
$('input[name=PlannedInvitationsOther]:checked') would work as well


PictureMan wrote:
>
> Ah.. one darn missing suqiggly can ruin the whole darn thing...
>
> Another question, related to that...
>
> I want when the user clicks inside the text box, that the matching radio
> button becomes the selected button.  Hence if they selected 100
> invitations,but then decided they want 10,000, thus have to type it int
> the
> box - i need the radio button to move.  And conversly if
> they go from the box to a radio button the box needs to clear out.
>
> For some reason this stoped working:
>
> $("input[name='PlannedInvitationsOther']").focus
>
> (function(){$("input[name='PlannedInvitations'][value='Other']").attr('checked',true);}
>     )
> $("input[name='PlannedInvitations']").focus
>     (function(){
>         $("input[name='PlannedInvitationsOther']").removeAttr("value");
>         }
>     )
>
>
> Ideas why?
>
> On Fri, Jul 31, 2009 at 3:38 PM, Leonardo K <leok85@gmail.com> wrote:
>
>> You are not closing the brackets in theses rules: PlannedInvitationsOther
>> and PlannedAttendanceOther
>>
>> PlannedInvitationsOther: {
>>     required: function(element){ return
>> $("input=[name='PlannedInvitations'][value='Other']").is(':checked'); },
>>     number: true
>> },
>>
>> PlannedAttendanceOther: {
>>     required: function(element) {return
>> $("input=[name='PlannedAttendance'][value='Other']").is(':checked');},
>>     number:true
>> },
>>
>> On Fri, Jul 31, 2009 at 16:29, PictureMan <polskystudios@gmail.com>
>> wrote:
>>
>>>
>>> I've actually confined (I think) the error to somewhere in the below
>>> code.  The 6 lines that are commented out contain the problem, as it
>>> stands now (with commented out sections) the page validates, when I
>>> uncomment either group, I get the same error.  I these 2 cases the
>>> required line is looking at a radio button with a specific value -
>>> think last item in a list of radio buttons, with a text box for more
>>> other info if that radio button is checked.
>>>
>>>
>>>
>>>                rules: {
>>>                        AgencyName: "required",
>>>                        Address1: "required",
>>>                        CityStateZip: "required",
>>>                        phone: {required: true, number: true, minlength:
>>> 10, maxlength:
>>> 10},
>>>                        Key_Contact: "required",
>>>                        EmailAddress: {required: true, email: true},
>>>                        EventAgencyName: "required",
>>>                        EventAddress: "required",
>>>                        EventCity: "required",
>>>                        EventZip: "required",
>>>                        EventState: "required",
>>>                        EventContact: "required",
>>>                        EventContactPerson: "required",
>>>                        EventPhoneNumber: {required: true, number: true,
>>> minlength: 10,
>>> maxlength: 10},
>>>                        EventEmailAddress: {required: true, email: true},
>>>                        EventWebsite: {url: true},
>>>                        Message: "required",
>>>                        Budget: {required:true, number:true},
>>>                        CabinsSoldTarget: {required:true, number:true},
>>>                        GrossSalesTarget: {required:true, number:true},
>>>                        OtherCruiseLine: {
>>>                                required: "#Other:checked"
>>>                                },
>>>                        DestinationsPicked: "required",
>>>                        PlannedInvitations: "required",
>>> //                      PlannedInvitationsOther: {
>>> //                              required: function(element){return
>>> $("input=
>>> [name='PlannedInvitations'][value='Other']").is(':checked');},
>>> //                              number: true,
>>>
>>>                        PlannedAttendance: "required",
>>> //                      PlannedAttendanceOther: {
>>> //                              required: function(element) {return
>>> $("input=
>>> [name='PlannedAttendance'][value='Other']").is(':checked');},
>>> //                              number:true,
>>>                        IntendToParticipate: "required"
>>>                        },
>>> On Jul 31, 3:08 pm, Leonardo K <leo...@gmail.com> wrote:
>>> > This problem occurs when a comma is missing. Post your entire code of
>>> the
>>> > validation.
>>> >
>>> > On Fri, Jul 31, 2009 at 16:00, PictureMan <polskystud...@gmail.com>
>>> wrote:
>>> >
>>> > > When I add this rule to a page with the other rules, my page stops
>>> > > validating.
>>> > > Works fine if I don't add it.
>>> >
>>> > > What this is for is a check box next to a input box.  IF the check
>>> box
>>> > > is checked, the field is mandatory.
>>> >
>>> > > OtherCruiseLine: {
>>> > >        required: function(element) {
>>> > >        return $("input[name='CruiseLinesPicked'][value='Other']").is
>>> > > (':checked');
>>> > > }
>>> >
>>> > > without this rule the page validates.  With this I get an error of:
>>> > > missing } after property list.
>>> >
>>> > > But not sure what's wrong..
>>> >
>>> > > Thanks!
>>>
>>
>>
>
>

--
View this message in context: http://www.nabble.com/What-am-i-doing-wrong-----tp24761535s27240p24764206.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.


No comments: