[jQuery] Problem while using 'Selector - dom traversal'

2009-10-05 Thread Bhavin

Hi,

I am trying to select the  "except the  - with ".

As per jquery book, I tried this.
but it is not working.

$('tr:not[th]:even').addClass('even');

can anybody tell me the solution ?

Thanks,
Bhavin.


[jQuery] jquery validate rules using css for dynamic controls

2009-01-30 Thread Bhavin

Hi,

In my application, controls are generated dynamically. I want to know
if I can configure rules by giving CSS classes and NOT by specifiying
element name while validating the fields.

I tried following code and works in some scenarios:

var isValid = $("#questionAnswerForm").validate({
  errorLabelContainer: "#messageBox",
   wrapper: "li"
});
if(isValid != null && !isValid.form()){
 return false;
  }

I am using struts controls like ,  etc. If I
specify error message in "title" and class="required" then works for
radio, text,textarea.

But how can I configure rules in this situation for e-mail, date,
number, checkbox, fileupload control, matrix control fields? Can I
specify CSS class in rules under validate() ?





[jQuery] Re: jqModal + validate + blockui plugins

2008-12-17 Thread Bhavin

 i have following js code:


 var qptarget = $('#qp div.jqmdMSG');
 ("#qpForm").validate();

  $("#qp").jqm({
  trigger:'a.qpTrigger',
  ajax:'@href',
  modal:true,
  overlay:80,
  target: qptarget,
  toTop:true,
  onShow: function(h){
  h.w.css('opacity',0.88).show();
  },
  onLoad: function(h){
  $("#saveqp",h.w).click(function(e){
 $.blockUI({ message: "Please wait..." });
 $.ajax({
  url: './saveqp.do?dispatch=save',
  type:'POST',
  datatype:'json',
  success:function(json){

  },
  complete: function(json){
  $.unblockUI();
  $(h.w).jqmHide();
  window.location.href = 
"./refreshSurvey.a2q?
dispatch=refresh";
  },
  error: function (error) {
  alert("error:" + error);
  }
});
return false;
  });
  }

  });

On Dec 17, 12:25 am, "Jörn Zaefferer" 
wrote:
> Could you provide a testpage?
>
> Jörn
>
>
>
> On Wed, Dec 17, 2008 at 2:30 AM, Bhavin  wrote:
>
> > Hi,
>
> > I am trying to implement validate plugin in jqModal. I tried validate
> > () method in onshow, onload method but it is not working. Can anyone
> > confirm whether it is supporting?
>
> > I tried blockui plugin to show "Please wait..." message on jqmodal
> > when form is submitted but its not working properly...Is this the
> > correct approach to show the message ?
>
> > Thanks,
> > Bhavin- Hide quoted text -
>
> - Show quoted text -


[jQuery] jqModal + validate + blockui plugins

2008-12-16 Thread Bhavin

Hi,

I am trying to implement validate plugin in jqModal. I tried validate
() method in onshow, onload method but it is not working. Can anyone
confirm whether it is supporting?

I tried blockui plugin to show "Please wait..." message on jqmodal
when form is submitted but its not working properly...Is this the
correct approach to show the message ?

Thanks,
Bhavin



[jQuery] show JSP using dialog plugin

2008-12-09 Thread Bhavin

Hi,

I want to show JSP as a dialog using dialog plugin. I dont prefer to
keep  elements in the page and show the dialog because user can
see all hidden divs using View Source. Can I pass URL in dialog() and
show the JSP as a modal window using JQuery?

Thanks,
Bhavin


[jQuery] Re: sortable issue

2008-12-08 Thread Bhavin

Thanks Richard. I think, I was confused about approach. I sortout this
issue by taking all the elements on update of the sequence and then
compare it with existing data in session and firing updates to only
elements which are changed.

On Dec 6, 1:12 pm, "Richard D. Worth" <[EMAIL PROTECTED]> wrote:
> I posed the example as I did because when you move element 5 from position 5
> to position 2 you are only moving one element, but it's affecting the
> position of 4 elements (2, 3, 4, 5). So when you say you only want to know
> about two elements, I'm confused about which two you would be talking about
> in my example. Are you saying you only want the elements that have moved?
>
> Perhaps grab the index of the element in the start callback and then again
> in the stop/change. Then your range of affected elements is between those
> two indexes.
>
> - Richard
>
>
>
> On Sat, Dec 6, 2008 at 3:53 PM, Bhavin <[EMAIL PROTECTED]> wrote:
>
> > Hi Richard,
>
> > Thanks for replying. I am trying to save /update sequence of elements
> > whenever it is changed. In following example, if you move 3rd element
> > at 2nd position then I wanted those two elements only in JS instead of
> > complete list. But it looks when we change sequence and try to save
> > the ordering then we need to fire updates for all the elements for
> > that position is changed..I am trying to figure out for better
> > approach here...
>
> > Thanks,
> > Bhavin
>
> > On Dec 6, 6:28 am, "Richard D. Worth" <[EMAIL PROTECTED]> wrote:
> > > I'm not sure your sample provides quite enough detail of what you're
> > going
> > > for. If you have the following
>
> > > 
> > >        
> > >        
> > >        
> > >        
> > >        
> > >        
> > > 
>
> > > and you drag 5 to be in-between 1 and 2, like so,
>
> > > 
> > >        
> > >        
> > >        
> > >        
> > >        
> > >        
> > > 
>
> > > then what do you want?
>
> > > - Richard
>
> > > On Fri, Dec 5, 2008 at 7:15 PM, Bhavin <[EMAIL PROTECTED]>
> > wrote:
>
> > > > Hi,
>
> > > > I am trying to find out element which are dragged & dropped on the
> > > > list in following method:
>
> > > > $("#example").sortable({
> > > >       //if i move "1" at second position then here i want array of
> > > > ids 2,1 sequence. ??
> > > >       // I tried selector but it gives me all the elements. ie.
> > > > 2,1,3.
> > > > });
>
> > > > 
> > > >        
> > > >        
> > > >        
> > > > 
>
> > > > Can anyone help me on this?- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -


[jQuery] Re: sortable issue

2008-12-06 Thread Bhavin

Hi Richard,

Thanks for replying. I am trying to save /update sequence of elements
whenever it is changed. In following example, if you move 3rd element
at 2nd position then I wanted those two elements only in JS instead of
complete list. But it looks when we change sequence and try to save
the ordering then we need to fire updates for all the elements for
that position is changed..I am trying to figure out for better
approach here...

Thanks,
Bhavin

On Dec 6, 6:28 am, "Richard D. Worth" <[EMAIL PROTECTED]> wrote:
> I'm not sure your sample provides quite enough detail of what you're going
> for. If you have the following
>
> 
>        
>        
>        
>        
>        
>        
> 
>
> and you drag 5 to be in-between 1 and 2, like so,
>
> 
>        
>        
>        
>        
>        
>        
> 
>
> then what do you want?
>
> - Richard
>
>
>
> On Fri, Dec 5, 2008 at 7:15 PM, Bhavin <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I am trying to find out element which are dragged & dropped on the
> > list in following method:
>
> > $("#example").sortable({
> >       //if i move "1" at second position then here i want array of
> > ids 2,1 sequence. ??
> >       // I tried selector but it gives me all the elements. ie.
> > 2,1,3.
> > });
>
> > 
> >        
> >        
> >        
> > 
>
> > Can anyone help me on this?- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"jQuery (English)" group.
To post to this group, send email to jquery-en@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-en?hl=en
-~--~~~~--~~--~--~---



[jQuery] sortable issue

2008-12-05 Thread Bhavin

Hi,

I am trying to find out element which are dragged & dropped on the
list in following method:

$("#example").sortable({
   //if i move "1" at second position then here i want array of
ids 2,1 sequence. ??
   // I tried selector but it gives me all the elements. ie.
2,1,3.
});








Can anyone help me on this?


[jQuery] Re: dynamic tree / treeview

2008-11-25 Thread Bhavin


I am using Struts here...referring "Action class" of struts..

Yes, when user saves the page it is inserted successfully in the
database. Data is then displayed on the same page...Now, user clicks
on refresh I need to fire an event to bring the data and render HTML.
Since I manipulated DOM, I won't have new id available in page
source.

Here is the sequence:
1) User types in browser http://server.com/page.do?dispatch=add - for
add operation
2) User will add the data and click on Save
3) Data is saved successfully. Here, I am trying to forward request to
"edit" action which will show another page so, I can show latest data
anytime on refresh event. I am able to forward the event successfully
but another page is not loaded. I think, because yest $.ajax() call is
not yet completed ?? I want to change URL in browser something like
http://server.com/page.do?dispatch=edit&pageid=123 - once data is
saved.

Following is my code. Let me know if you can suggest on this or if you
have any further questions:


  $('#savepage').click(function(e) {

  $.blockUI({ message: "Page:Please wait..." 
});

  $.ajax({
  url: '/savePage.do?dispatch=save',
  type:'POST',
  dataType:'json',
  data:{pageid:$("#pageid").val(),pagename:$
("#pagename").val()},
  cache: false,
  success:function(json){
  // here I can manipulate DOM and
show the inserted data
  //$.get('/editPage.htm?dispatch=edit&pageid=' +
json.pageid);
  },
  complete: function(){
  $("#pageid").val("");
  $("#pagename").val("");
  $.unblockUI();
  },
  error: function (error) {
      alert("error:" + error);
  }
  });
  return false;
  });

Thanks,
Bhavin

On Nov 25, 12:00 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote:
> Unfortunately, I'm not familiar with "Action class"  Is this a JSP thing?
>
> When the user saves the new page with an ajax call, is it recorded in a
> database?
>
> If so, when the user then refreshes, shouldn't the server output the new
> page nodes correctly during the HTML render?
>
> JK
>
>
>
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
>
> Behalf Of Bhavin
> Sent: Tuesday, November 25, 2008 11:53 AM
> To: jQuery (English)
> Subject: [jQuery] Re: dynamic tree / treeview
>
> Thanks Jeffrey. I solved issue# 1 almost similar way you suggested.
> But I am more concern about issue # 2. I am not sure about the flow. I
> want something like:
>
> 1) Click on Create Page link. I want to allow users to create data
> which will be internally displayed in  elements and user can
> drag&drop and save the sequence.
> 2) Open dialog, enter data & Save. Here I am using $.ajax(). Bringing
> data from Action class in JSON datatype.
> 3) I will get data in success of $.ajax(). I can manipulate DOM,
> insert  elements with data and similar way I can create child,
> subchild of the nodes.
>
> The problem here is: When I create children dynamically, I want to
> make sure if user clicks on "Refresh" button then also data should be
> retained on the page. In above case, it is not retaining because I am
> not sure how to go ahead with that. Should I capture "Refresh" event,
> fire event to the Action class, bring the data and show it on the
> page? Or is there any other alternative? How can I make sure that
> whatever data I am showing on the page is updated one and latest?
>
> Please advice.
>
> Thanks,
> Bhavin
>
> On Nov 22, 3:29 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote:
> > I'm not 100% I understood your question, but I'll give it a shot.
>
> > I have a dynamically rendered TreeView that is showing a page hierarchy,
> > parent and child.
>
> > There is an option to add/remove pages, as well as drag them around.
>
> > Because I need the id of the page and its parent, I render it in the HTML
> as
> > an attribute.
>
> > 
> >   PageName1
> >   
> >     PageName2
> >     PageName3
> >   
> > 
>
> > Database updates are handled as such:
>
> > var li = $(this);
> > var pageid = parseInt(li.attr('_pageid'));
> > var parentid = parseInt(li.parents

[jQuery] Re: dynamic tree / treeview

2008-11-25 Thread Bhavin


Thanks Jeffrey. I solved issue# 1 almost similar way you suggested.
But I am more concern about issue # 2. I am not sure about the flow. I
want something like:

1) Click on Create Page link. I want to allow users to create data
which will be internally displayed in  elements and user can
drag&drop and save the sequence.
2) Open dialog, enter data & Save. Here I am using $.ajax(). Bringing
data from Action class in JSON datatype.
3) I will get data in success of $.ajax(). I can manipulate DOM,
insert  elements with data and similar way I can create child,
subchild of the nodes.

The problem here is: When I create children dynamically, I want to
make sure if user clicks on "Refresh" button then also data should be
retained on the page. In above case, it is not retaining because I am
not sure how to go ahead with that. Should I capture "Refresh" event,
fire event to the Action class, bring the data and show it on the
page? Or is there any other alternative? How can I make sure that
whatever data I am showing on the page is updated one and latest?

Please advice.

Thanks,
Bhavin




On Nov 22, 3:29 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote:
> I'm not 100% I understood your question, but I'll give it a shot.
>
> I have a dynamically rendered TreeView that is showing a page hierarchy,
> parent and child.
>
> There is an option to add/remove pages, as well as drag them around.
>
> Because I need the id of the page and its parent, I render it in the HTML as
> an attribute.
>
> 
>   PageName1
>   
>     PageName2
>     PageName3
>   
> 
>
> Database updates are handled as such:
>
> var li = $(this);
> var pageid = parseInt(li.attr('_pageid'));
> var parentid = parseInt(li.parents('li:first').attr('_pageid'));
>
> If I have a new set of child pages to render after an ajax call:
>
> var li =tree.find('li[_pageid='+pageid+']');
> if (li.length)
> {
>   var ul = li.children('ul');
>   if (!ul.length)
>     ul = $('').appendTo(li);
>   ul.html(newchildnodes);
>
> }
>
> Does this help?
>
> JK
>
>
>
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
>
> Behalf Of Bhavin
> Sent: Saturday, November 22, 2008 2:48 PM
> To: jQuery (English)
> Subject: [jQuery] Re:dynamictree/ treeview
>
> Anybody can guide me on this?
>
> On Nov 21, 12:55 am, Bhavin <[EMAIL PROTECTED]> wrote:
> > Hi
>
> > I am using jquery to createtreestructure type of functionality
> > dynamically. I have to add nodes by opening dialog and save it into
> > the database. Once response is returned then I need to show it on the
> > page. I have few doubts here:
>
> > 1) Once node is inserted into the database and response is rendered on
> > the page then how can I fetch id/value of the node. Here, DOM
> > shouldn't be updated automatically? I am not able to fetch parent node
> > id while adding child into it.
>
> > 2) Once data is rendered on the page and if I refresh it then how
> > should I show thetreewhich was already created dynamically? Do I
> > need to bring all the data from the database by passing parentid?
>
> > Please guide.
>
> > Thanks,
> > Bhavin- Hide quoted text -
>
> - Show quoted text -


[jQuery] Re: dynamic tree / treeview

2008-11-22 Thread Bhavin

Anybody can guide me on this?

On Nov 21, 12:55 am, Bhavin <[EMAIL PROTECTED]> wrote:
> Hi
>
> I am using jquery to createtreestructure type of functionality
> dynamically. I have to add nodes by opening dialog and save it into
> the database. Once response is returned then I need to show it on the
> page. I have few doubts here:
>
> 1) Once node is inserted into the database and response is rendered on
> the page then how can I fetch id/value of the node. Here, DOM
> shouldn't be updated automatically? I am not able to fetch parent node
> id while adding child into it.
>
> 2) Once data is rendered on the page and if I refresh it then how
> should I show thetreewhich was already created dynamically? Do I
> need to bring all the data from the database by passing parentid?
>
> Please guide.
>
> Thanks,
> Bhavin


[jQuery] dynamic tree / treeview

2008-11-21 Thread Bhavin

Hi

I am using jquery to create tree structure type of functionality
dynamically. I have to add nodes by opening dialog and save it into
the database. Once response is returned then I need to show it on the
page. I have few doubts here:

1) Once node is inserted into the database and response is rendered on
the page then how can I fetch id/value of the node. Here, DOM
shouldn't be updated automatically? I am not able to fetch parent node
id while adding child into it.

2) Once data is rendered on the page and if I refresh it then how
should I show the tree which was already created dynamically? Do I
need to bring all the data from the database by passing parentid?

Please guide.

Thanks,
Bhavin


[jQuery] Re: Jquery + Struts

2008-11-19 Thread Bhavin

Hi George,

Thanks for your response. I will see form-plug-in as per your
suggestion. But I doubt whether I would be able to interact with
Struts form using that.

Thanks,
Bhavin

On Nov 18, 7:15 pm, George <[EMAIL PROTECTED]> wrote:
> I'll try to answer.
> I do not know what 'struts' is. but you have made major mistake in
> your wishes.
>
> AJAX submit the data to the server and gets server's response.
> It's your responsibility to collect data for AJAX call and parse out
> server's response.
>
> So you correctly put return false to prevent submitting the form
> through regular means by the browser but failed to collect data and
> parse it out.
>
> To collect data from the "form plug-in" will help.
>
> As to parse it out you will have to do it yourself. Since first you
> need to define the in which data structure you returning data from the
> server.
> I recommend JSON
>
> George.
>
> On Nov 18, 7:35 pm, Bhavin <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I am using JQuery withStruts1.1. I am using following code when
> > user
> > clicks on Save button:
>
> >  $('#save').click(function() {
> >            $.blockUI({ message: "Please wait..." });
>
> >            $.ajax({
> >                url: '/saveData.do?dispatch=save',
> >                type:'post',
> >                cache: false,
> >                dataType:'xml',
> >                complete: function() {
> >                    $.unblockUI();
> >                }
> >            });
>
> > Following is mystrutscode:
>
> > 
> >          > method="POST">
> >         
> >                 Name: 
> >                 Description:  > rows="8"
> > cols="10"/>
> >                  > key="button.save"/> > html:submit>
> >                  > key="button.cancel"/> > html:cancel>
> >         
> >         
> > 
>
> > The problem here is it is submitting request twice because it is
> > defined withstrutsform and with url (in ajax). How can I avoid
> > duplicate request?
>
> > I tried return false in click event but then actionform is not
> > populated from jsp fields.
>
> > Can anyone give working example of Jquery +Struts1 ?
>
> > Thanks,
> > Bhavin


[jQuery] Re: Jquery + Struts

2008-11-19 Thread Bhavin

Hi Youssef,

I have constraint to use struts 1. "action" attribute is mandatory
with  tag. I can not avoid it.  I think, struts 1 has
constraint to work with Ajax as per their framework specification and
that would be the reason Struts 2 has lots of changes... I would
appreciate if you can point me to any link where Jquery is supporting
to Struts 1 with working example of CRUD operations.

Thanks,
Bhavin

On Nov 18, 9:53 pm, "Youssef EL ALAOUI" <[EMAIL PROTECTED]>
wrote:
> Hi Bhavin,
>
> Why you are defining "/saveTemplate.htm?dispatch=save" in the action
> parameter of your form whereas you have already the saveData action defined
> in the click handler? Would you please delete the
> "action="/saveTemplate.htm?dispatch=save"" from your JSP page and let only
> the click handle do its work. Thanks to let us know what it gives you as
> result?
>
> Regads,
>
> PS: Struts2 is much smart regarding Ajax, you can try to use it instead
> version 1.
> --
> Youssef ELALAOUI
> JCargoo Founderwww.jcargoo.org
>
> Pensez à l'environnement avant d'imprimer ce message / Think of the
> environment before printing out this message
>
> On Wed, Nov 19, 2008 at 1:35 AM, Bhavin <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I am using JQuery with Struts 1.1. I am using following code when
> > user
> > clicks on Save button:
>
> >  $('#save').click(function() {
> >           $.blockUI({ message: "Please wait..." });
>
> >           $.ajax({
> >               url: '/saveData.do?dispatch=save',
> >               type:'post',
> >               cache: false,
> >               dataType:'xml',
> >               complete: function() {
> >                   $.unblockUI();
> >               }
> >           });
>
> > Following is my struts code:
>
> > 
> >         > method="POST">
> >        
> >                Name: 
> >                Description:  > rows="8"
> > cols="10"/>
> >                 > key="button.save"/> > html:submit>
> >                 > key="button.cancel"/> > html:cancel>
> >        
> >        
> > 
>
> > The problem here is it is submitting request twice because it is
> > defined with struts form and with url (in ajax). How can I avoid
> > duplicate request?
>
> > I tried return false in click event but then actionform is not
> > populated from jsp fields.
>
> > Can anyone give working example of Jquery + Struts 1 ?
>
> > Thanks,
> > Bhavin


[jQuery] Jquery + Struts

2008-11-18 Thread Bhavin

Hi,

I am using JQuery with Struts 1.1. I am using following code when
user
clicks on Save button:


 $('#save').click(function() {
   $.blockUI({ message: "Please wait..." });


   $.ajax({
   url: '/saveData.do?dispatch=save',
   type:'post',
   cache: false,
   dataType:'xml',
   complete: function() {
   $.unblockUI();
   }
   });


Following is my struts code:





Name: 
Description: 







The problem here is it is submitting request twice because it is
defined with struts form and with url (in ajax). How can I avoid
duplicate request?

I tried return false in click event but then actionform is not
populated from jsp fields.

Can anyone give working example of Jquery + Struts 1 ?

Thanks,
Bhavin




[jQuery] Jquery with Struts

2008-11-18 Thread Bhavin

Hi,

I am using JQuery with Struts 1.1. I am using following code when
user
clicks on Save button:


 $('#save').click(function() {
   $.blockUI({ message: "Please wait..." });


   $.ajax({
   url: '/saveData.do?dispatch=save',
   type:'post',
   cache: false,
   dataType:'xml',
   complete: function() {
   $.unblockUI();
   }
   });


Following is my struts code:





Name: 
Description: 







The problem here is it is submitting request twice because it is
defined with struts form and with url (in ajax). How can I avoid
duplicate request?

Also, I am looking for code samples of JQuery + Struts 1. Could not
find much content online...

Thanks,
Bhavin