You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Robert Breidecker <rb...@yahoo.com> on 2005/03/31 21:05:39 UTC

How to submit form from Javascript?

I have a delete button on my screen and I would like
to popup a confirmation window to the user and confirm
that the deletion should take place.

I need to the popup window to capture the answer to
the question and then control to pass back to the
parent window to process the delete based on the
answer.

How can I do that in JSF.  I know how to set the
answer back on the parent window using Javascript and
I know how to submit a form from Javascript.  But how
do I tell what action to execute when submitting a
form from Javascript?

Thanks,
Rob Breidecker


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 

Mail archive > spam problem

Posted by Adrien FOURES <af...@sigems.fr>.
Hello!

I subscribed to the mailling list in october 2004, since january 2005 i 
have recevide a lot of spam. And finally i try in google my e mail 
adress ..... and google found it three time uncrypted

mail-archives.eu.apache.org/mod_mbox/incubator-myfaces-user/ 
200501.mbox/%3C41FE67D0.1050100@sigems.fr%3E
mail-archives.eu.apache.org/mod_mbox/incubator-myfaces-user/ 
200501.mbox/%3C41FE059B.8020105@sigems.fr%3E
incubator.apache.org/mail/myfaces-user/200503

Please can you delete this mail, or encrypted my e mail adress.


Thank a lot for your repply,

Adrien

Re: How to submit form from Javascript?

Posted by Slawek <ss...@o2.pl>.
the easiest way is to do it like that:

function myConfirmation(question){
	if (confirm(question))
		return true;
	return false;
}

<h:commandButton action="#{bean.deletesth}" value="blah" onclick="return 
myConfirmation('sure?')" />


confirm(string) is standard JS function that displays dialog box-u must 
know that box...

returning false will cancel submit propagation.
/*********
Heath - i knew that but i didnt realize that i can use that fact in my 
problem:P.
im so lame:/

Big thanks AGAIN Heath!
************/


BUT

i u really must do it with special popu window...

u can make on parent page the commandbutton with action that deletes sth. 
u can hide it by css. u can  give id to that button.

form your popup window u can click that button:
window.opener.document.getElementById('formID:delButtonId').click();

slawek

<rb...@yahoo.com> napisaƂ:

> I have a delete button on my screen and I would like
> to popup a confirmation window to the user and confirm
> that the deletion should take place.
>
> I need to the popup window to capture the answer to
> the question and then control to pass back to the
> parent window to process the delete based on the
> answer.
>
> How can I do that in JSF.  I know how to set the
> answer back on the parent window using Javascript and
> I know how to submit a form from Javascript.  But how
> do I tell what action to execute when submitting a
> form from Javascript?
>
> Thanks,
> Rob Breidecker
>
>
> 		
> __________________________________
> Do you Yahoo!?
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/
>