Loading ...
Sorry, an error occurred while loading the content.

Re: Submit button with SimpleDialog as alert

Expand Messages
  • bretlevy
    here to serve! ~~bret ... it ... clicked ... Edit ... was ... very ... () { ... so ... fine. ... handlers ... to ... you ... ( container ); ... Nabble.com. ...
    Message 1 of 14 , Feb 5, 2009
    • 0 Attachment
      here to serve!

      ~~bret

      --- In ydn-javascript@yahoogroups.com, Marcel Overdijk
      <marceloverdijk@...> wrote:
      >
      >
      > Thanks for your patience and the clarification Bret.
      > I see/understand how you did it now.
      >
      > Cheers,
      > Marcel
      >
      >
      > bretlevy wrote:
      > >
      > >
      > > I have expanded the demo with a little more explanation. See if
      it
      > > is better for you.
      > >
      > > http://yuihelp.levycodev.com/demos/dialog/confirm_on_submit.php
      > >
      > > ~~bret
      > >
      > >
      > > --- In ydn-javascript@yahoogroups.com, Marcel Overdijk
      > > <marceloverdijk@> wrote:
      > >>
      > >>
      > >> Hi Brett,
      > >>
      > >> I checked the code but found 1 problem.
      > >>
      > >> In sendForm
      > >>
      > >> function sendForm (frm, action) {
      > >> frmDemo.hide();
      > >> YInfo ('At this point the form would be submitted via
      > > javascript
      > >> \"frm.submit()\" or via an ajax call. The requested action is
      > >> \''+action+'\'.');
      > >> }
      > >>
      > >> you provide the action, but just send the form.
      > >>
      > >> So this piece is still missing: I don't know which submit button
      > > was pressed
      > >> (e.g. delete or edit).
      > >> My server request checks this based on the value of the button
      > > which was
      > >> submitted...
      > >>
      > >> Any idea?
      > >>
      > >>
      > >> bretlevy wrote:
      > >> >
      > >> >
      > >> > Hi Marcel:
      > >> >
      > >> > See if this helps you any:
      > >> >
      > >> > http://yuihelp.levycodev.com/demos/dialog/confirm_on_submit.php
      > >> >
      > >> > ~~bret
      > >> >
      > >> >
      > >> > --- In ydn-javascript@yahoogroups.com, Marcel Overdijk
      > >> > <marceloverdijk@> wrote:
      > >> >>
      > >> >>
      > >> >> repost/retry
      > >> >>
      > >> >>
      > >> >> Marcel Overdijk wrote:
      > >> >> >
      > >> >> > Any ideas? I'm still facing this problem...
      > >> >> >
      > >> >> >
      > >> >> > Marcel Overdijk wrote:
      > >> >> >>
      > >> >> >> Hi,
      > >> >> >>
      > >> >> >> I understand how I can call a handler using onClick.
      > >> >> >> But how can I then submit that button when the user
      clicked
      > > yes.
      > >> >> >>
      > >> >> >> As obj I could pass though the button object I guess, but
      > > then
      > >> > how to
      > >> >> >> submit it?
      > >> >> >>
      > >> >> >> Note that my form has 2 submit buttons. One with value
      Edit
      > > and
      > >> > one with
      > >> >> >> value Delete.
      > >> >> >> So when submitting the form I have to know which button
      was
      > >> > pressed...
      > >> >> >>
      > >> >> >>
      > >> >> >> Cheers,
      > >> >> >> Marcel
      > >> >> >>
      > >> >> >>
      > >> >> >>
      > >> >> >> lou_tribal wrote:
      > >> >> >>>
      > >> >> >>> If you look at this example you will find everything you
      > > need:
      > >> >> >>>
      > >> >> >>>
      > > http://developer.yahoo.com/yui/examples/container/simpledialog-
      > >> > quickstart.html
      > >> >> >>>
      > >> >> >>> <
      > >> >> >>>
      > >> >> >>> <script type="text/javascri pt">
      > >> >> >>> YAHOO.util.Event. onDOMReady( function () {
      > >> >> >>> new YAHOO.widget. Button("delete", {onclick:
      > >> > {fn:myClickFunction,
      > >> >> >>> obj:}} );
      > >> >> >>> });
      > >> >> >>> </script>
      > >> >> >>>
      > >> >> >>> --- In ydn-javascript@yahoogroups.com, Marcel Overdijk
      > >> >> >>> <marceloverdijk@> wrote:
      > >> >> >>>>
      > >> >> >>>>
      > >> >> >>>> I'm wondering if somebody has an idea. I think this is
      very
      > >> > standard
      > >> >> >>>> use
      > >> >> >>>> case.
      > >> >> >>>>
      > >> >> >>>>
      > >> >> >>>>
      > >> >> >>>> Marcel Overdijk wrote:
      > >> >> >>>> >
      > >> >> >>>> > I'm creating a submit button on my page as below:
      > >> >> >>>> >
      > >> >> >>>> >
      > >> >> >>>> >
      > >> >> >>>> > <input type="submit"
      > >> > name="_action_Delete"
      > >> >> >>>> > value="Delete" />
      > >> >> >>>> >
      > >> >> >>>> >
      > >> >> >>>> > <script type="text/javascript">
      > >> >> >>>> > YAHOO.util.Event.onDOMReady(function
      () {
      > >> >> >>>> > new YAHOO.widget.Button("delete");
      > >> >> >>>> > });
      > >> >> >>>> > </script>
      > >> >> >>>> >
      > >> >> >>>> > The page/form contains additional button (e.g. edit)
      so
      > > the
      > >> >> >>> name/value of
      > >> >> >>>> > the button clicked is important.
      > >> >> >>>> > In my backend I use this to determine which button was
      > >> > clicked and
      > >> >> >>> execute
      > >> >> >>>> > some action.
      > >> >> >>>> >
      > >> >> >>>> > Now before submitting a delete request I want the end-
      > > user
      > >> > to show
      > >> >> >>> a alert
      > >> >> >>>> > using a simpleDialog.
      > >> >> >>>> > Before using Yui I used a simple alert which worked
      fine.
      > >> >> >>>> >
      > >> >> >>>> > I'm using this:
      > >> >> >>>> >
      > >> >> >>>> > // Define various event
      handlers
      > > for
      > >> > Dialog
      > >> >> >>>> > var handleYes = function() {
      > >> >> >>>> > alert("You clicked yes!");
      > >> >> >>>> > this.hide();
      > >> >> >>>> > };
      > >> >> >>>> > var handleNo = function() {
      > >> >> >>>> > this.hide();
      > >> >> >>>> > };
      > >> >> >>>> >
      > >> >> >>>> > // Instantiate the Dialog
      > >> >> >>>> > var simpledialog1 = new
      > >> >> >>>> > YAHOO.widget.SimpleDialog("simpledialog1",
      > >> >> >>>> > { width: "300px",
      > >> >> >>>> > fixedcenter: true,
      > >> >> >>>> > visible: false,
      > >> >> >>>> > draggable: false,
      > >> >> >>>> > close: true,
      > >> >> >>>> > text: "Do you want
      to
      > >> > continue?",
      > >> >> >>>> > icon:
      > >> >> >>>> > YAHOO.widget.SimpleDialog.ICON_HELP,
      > >> >> >>>> >
      constraintoviewport:
      > > true,
      > >> >> >>>> > modal: true,
      > >> >> >>>> > buttons: [ {
      > > text:"Yes",
      > >> >> >>>> > handler:handleYes, isDefault:true },
      > >> >> >>>> > {
      > > text:"No",
      > >> >> >>>> > handler:handleNo } ]
      > >> >> >>>> > } );
      > >> >> >>>> > simpledialog1.setHeader("Are
      you
      > >> > sure?");
      > >> >> >>>> > simpledialog1.render
      ("container");
      > >> >> >>>> >
      > >> >> >>>> > YAHOO.util.Event.addListener
      > >> > ("show", "click",
      > >> >> >>>> > simpledialog1.show, simpledialog1, true);
      > >> >> >>>> >
      > >> >> >>>> > But I'm missing the final piece....
      > >> >> >>>> >
      > >> >> >>>> > How can hook up the dialog to the delete button click,
      > > and
      > >> > the when
      > >> >> >>>> > pressing yes send the submit?
      > >> >> >>>> >
      > >> >> >>>>
      > >> >> >>>> --
      > >> >> >>>> View this message in context:
      > >> >> >>> http://www.nabble.com/Submit-button-with-SimpleDialog-as-
      > > alert-
      > >> > tp21507820p21543247.html
      > >> >> >>>> Sent from the ydn-javascript mailing list archive at
      > >> > Nabble.com.
      > >> >> >>>>
      > >> >> >>>
      > >> >> >>>
      > >> >> >>>
      > >> >> >>>
      > >> >> >>
      > >> >> >>
      > >> >> >
      > >> >> >
      > >> >>
      > >> >> --
      > >> >> View this message in context: http://www.nabble.com/Submit-
      > > button-
      > >> > with-SimpleDialog-as-alert-tp21507820p21840320.html
      > >> >> Sent from the ydn-javascript mailing list archive at
      Nabble.com.
      > >> >>
      > >> >
      > >> >
      > >> >
      > >> >
      > >>
      > >> --
      > >> View this message in context: http://www.nabble.com/Submit-
      button-
      > > with-SimpleDialog-as-alert-tp21507820p21850885.html
      > >> Sent from the ydn-javascript mailing list archive at Nabble.com.
      > >>
      > >
      > >
      > >
      > >
      >
      > --
      > View this message in context: http://www.nabble.com/Submit-button-
      with-SimpleDialog-as-alert-tp21507820p21859264.html
      > Sent from the ydn-javascript mailing list archive at Nabble.com.
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.