Invoke javascript through Mixin with actionLink and click event

2010-07-02 Thread SakshiAgarwal

Hi,

In the below example, I am trying to invoke javascript when I click on
Approve link and also on Disapprove. [While disapproving, I am submitting
the form as I want to submit reported category along with it, while on
approve I am just changing the status[approve/disapprove] of my photo in
java code ]
Photos.tml
t:loop source=photoDetails value=each index=counter  
   div t:type=zone t:id=photoZone id=prop:zoneId
t:form t:id=formId t:zone=prop:zoneId
   t:hidden value=counter/
 [t:actionlink t:id=approvePhotos context=${counter} zone=prop:zoneId
t:mixins=ConfirmApprove/t:actionlink]
 pt:label for=reportedCategory/
 t:select t:id=reportedCategory t:label=Category//p
 input type=submit t:type=submit t:id=photo value=Disapprove Photo
onClick=extraStep(${counter}); /
 /t:form
   /div
 /t:loop   

Everything works fine, except that my javascript code is invoked when I move
from Index page to Photos page and not on clicking 'approve link'. The logic
which I have used for Disapprove doesn't work with 'approve' actionLink.

my Confirm.java is as follows:
@IncludeJavaScriptLibrary(Confirm.js)
public class Confirm {

@Parameter(value = Are you sure?, defaultPrefix =
BindingConstants.LITERAL)
private String message;

@Inject
private RenderSupport renderSupport;

@InjectContainer
private ClientElement element;

@AfterRender
public void afterRender() {
renderSupport.addScript(String.format(new Confirm('%s');,
  element.getClientId()));
}
   
}

Confirm.js
var Confirm = Class.create();
Confirm.prototype = {
initialize: function(element) {
alert(element + element);
Event.observe($(element), 'click',
this.doConfirm.bindAsEventListener(this));
},

doConfirm: function(e) {
e.style.display = 'none';
alert(in javascript in js file);
e.stop();
}
}

Kindly help me as to how can I invoke javascript on clicking approve link.

Looking forward for your support.

Regards
Sakshi
-- 
View this message in context: 
http://old.nabble.com/Invoke-javascript-through-Mixin-with-actionLink-and-click-event-tp29052536p29052536.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Updating a Zone with Actionlink doesn't work (Return type can not be handled)

2010-06-24 Thread SakshiAgarwal

Thanks a lot..now this works for me...I am so happy about it as I have
been struggling through it since many days...
my another doubt is - if i replace submit component with linksubmit; my
javascript method onclick is not getting invoked...
Whereas, if i use JSON or mixin my script is invoked only on page render.
i.e when I open my Photo page(and that time, counter value is not even set,
so no way to inform which form to hide) and it doesn't get called again on
submitting the sub form.

Any workaround for that ?

Regards
Sakshi


Jonathan Barker wrote:
 
 You need to make sure that the form's zone parameter is set to the id and
 not just the t:id of the Zone.  I started generating my own xml id's from
 a
 root name and the actual database id of the object I was about to use.
 
 I can't speak to mixing in the custom javascript, except that when the
 Ajax
 submit is working properly, the response should effectively clear the
 display:none that you just set before sending the request.  Your response
 need's to indicate that the style of the form should be hidden - or don't
 even return a form, return some text to indicate it's been dealt with.  If
 that is the case, then you won't need the custom javascript anyway.
 
 You might also want to consider setting the context of the form.  I've
 bumped my head on problems with loop state and forms before, but it does
 depend what you are looping over.  Nested loops can be fun.
 
 JB
 
 
 On Thu, Jun 24, 2010 at 12:52 AM, SakshiAgarwal
 sakshi.a...@gmail.comwrote:
 

 Hi,

 I did check this example, but it helped me only to some extent.
 The main problem in my case is:
 the structure of my TML file is like this:
 Loop
  Zone
 Form (defined photoZOne here)
Submit
 the main problem is: counter value for first form does not function
 properly...it gives very unpredictable results..for rest of the
 subsequent
 forms ( from the loop) works properly...

 Any suggestions/advice ?
 http://old.nabble.com/file/p28978902/photos.tml photos.tml

 I hope I am clear in my problem stmt. Looking fwd for solution for my
 problem.
 regards
 sakshi

 P.S. The reason I use zone here is: I have 'reported catergory' attached
 to
 each photo. and if I disapprove I need to submit it with the reason i.e.
 'reported category' that particular photo. So i can't submit the entire
 form( as it contains multiple photos).
 I also need to add java script in my code as I want to hide the photo as
 soon as i take action on it. (i.e. approve/disapprove)
 Looked at many examples but nothing works fine with everything in place,
 i.e. zone,loop,form,javascript all together


 Geoff Callender-2 wrote:
 
  Does this example help?
 
 
 
 http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/ajaxform
 
  On 23/06/2010, at 3:06 PM, SakshiAgarwal wrote:
 
 
  Hi,
 
  Thanks a lot for the reply. It works now.
  I have been struggling hard to make zone work with Form Submit
 component.
  I read on http://www.infoq.com/articles/tapestry5-intro, how to make
 AJAX
  request.
  So accordingly from my attached Photos.tml file, I should make
  onSuccessFromDisapprovePhoto and from this method I should return Zone
  body.
 
  But in my case, none of the methods are getting invoked - eg:
  onSelectedFromDisapprovePhoto/onSuccessFromDisapprovePhoto
  They work fine with ActionLink but not otherwise.
 
  http://old.nabble.com/file/p28967834/Photos.java Photos.java
  http://old.nabble.com/file/p28967834/Photos.tml Photos.tml
 
  In my case, I have tried JSON, Mixin for javascript code. but none
 works
  with zone.
  How to make it a AJAX request??
  Please guide me.
 
  regards
  sakshi
 
  --
  View this message in context:
 
 http://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28967834.html
  Sent from the Tapestry - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 

 --
 View this message in context:
 http://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28978902.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org


 
 
 -- 
 Jonathan Barker
 ITStrategic
 
 

-- 
View this message in context: 
http://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28989193

Re: Updating a Zone with Actionlink doesn't work (Return type can not be handled)

2010-06-23 Thread SakshiAgarwal

Hi,

I did check this example, but it helped me only to some extent.
The main problem in my case is:
the structure of my TML file is like this:
Loop
  Zone
 Form (defined photoZOne here)
Submit
the main problem is: counter value for first form does not function
properly...it gives very unpredictable results..for rest of the subsequent
forms ( from the loop) works properly...

Any suggestions/advice ?
http://old.nabble.com/file/p28978902/photos.tml photos.tml 

I hope I am clear in my problem stmt. Looking fwd for solution for my
problem.
regards
sakshi

P.S. The reason I use zone here is: I have 'reported catergory' attached to
each photo. and if I disapprove I need to submit it with the reason i.e.
'reported category' that particular photo. So i can't submit the entire
form( as it contains multiple photos).
I also need to add java script in my code as I want to hide the photo as
soon as i take action on it. (i.e. approve/disapprove)
Looked at many examples but nothing works fine with everything in place,
i.e. zone,loop,form,javascript all together


Geoff Callender-2 wrote:
 
 Does this example help? 
 
 
 http://jumpstart.doublenegative.com.au/jumpstart/examples/javascript/ajaxform
 
 On 23/06/2010, at 3:06 PM, SakshiAgarwal wrote:
 
 
 Hi,
 
 Thanks a lot for the reply. It works now.
 I have been struggling hard to make zone work with Form Submit component.
 I read on http://www.infoq.com/articles/tapestry5-intro, how to make AJAX
 request. 
 So accordingly from my attached Photos.tml file, I should make
 onSuccessFromDisapprovePhoto and from this method I should return Zone
 body.
 
 But in my case, none of the methods are getting invoked - eg:
 onSelectedFromDisapprovePhoto/onSuccessFromDisapprovePhoto 
 They work fine with ActionLink but not otherwise.
 
 http://old.nabble.com/file/p28967834/Photos.java Photos.java 
 http://old.nabble.com/file/p28967834/Photos.tml Photos.tml 
 
 In my case, I have tried JSON, Mixin for javascript code. but none works
 with zone.
 How to make it a AJAX request??
 Please guide me.
 
 regards
 sakshi
 
 -- 
 View this message in context:
 http://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28967834.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
 For additional commands, e-mail: users-h...@tapestry.apache.org
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28978902.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Updating a Zone with Actionlink doesn't work (Return type can not be handled)

2010-06-22 Thread SakshiAgarwal

Hi 

Did u get the solution to ur problem.
I am facing the same problem
component event handler method returned the value Block[Body of
Photos:photozone, at context:Photos.tml, line 28]. Return type
org.apache.tapestry5.internal.structure.BlockImpl can not be handled

regards
sakshi
-- 
View this message in context: 
http://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28956471.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Updating a Zone with Actionlink doesn't work (Return type can not be handled)

2010-06-22 Thread SakshiAgarwal

Hi,

Thanks a lot for the reply. It works now.
I have been struggling hard to make zone work with Form Submit component.
I read on http://www.infoq.com/articles/tapestry5-intro, how to make AJAX
request. 
So accordingly from my attached Photos.tml file, I should make
onSuccessFromDisapprovePhoto and from this method I should return Zone body.

But in my case, none of the methods are getting invoked - eg:
onSelectedFromDisapprovePhoto/onSuccessFromDisapprovePhoto 
They work fine with ActionLink but not otherwise.

http://old.nabble.com/file/p28967834/Photos.java Photos.java 
http://old.nabble.com/file/p28967834/Photos.tml Photos.tml 

In my case, I have tried JSON, Mixin for javascript code. but none works
with zone.
How to make it a AJAX request??
Please guide me.

regards
sakshi

-- 
View this message in context: 
http://old.nabble.com/Updating-a-Zone-with-Actionlink-doesn%27t-work-%28Return-type-can-not-be-handled%29-tp27355636p28967834.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Invoke Javascript using LinkSubmit

2010-06-17 Thread SakshiAgarwal

Hi,

i have used multiple options to invoke javascript on clicking linkSubmit,
but none works, although they all work with Submit.
a) Invoking javascript from tml page as follows:
 script
  function extraStep() {
alert(ENTER extraStep);  
  }
/script
 t:loop source=photoDetails value=each -${each.title}  br /
t:form t:id=formId id=formIdp
t:label for=reportedCategory/  t:select t:id=reportedCategory
t:label=Reported Category//p
[t:actionlink t:id=approvePhotosApprove/t:actionlink]
  input type=hidden id=photoObject value=${each} /
t:submit t:id=disapprovePhoto value=Disapprove Photo 
onclick=extraStep();/t:submit
  /t:form  
/t:loop
** This works with Submit but not with linkSubmit
b) tried using mixins, but didnt work with LinkSubmit
c) tried using JSON, but that also didnt work with LinkSubmit. afterRender()
does not get invoked.
onSuccess(),onSelectedFromDisapprovePhoto() methods are not invoked from
Linksubmit.

Can someone please advise how can I use LinkSubmit in order to invoke
javascript.
Looking forward for an early response.

regards
sakshi
-- 
View this message in context: 
http://old.nabble.com/Invoke-Javascript-using-LinkSubmit-tp28922231p28922231.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org