Re: Making an anchor behave like a button
Carl G <[email protected]> Sat, 8 Mar 2025 13:28:46 -0500
| Newsgroups | gmane.comp.lang.smalltalk.squeak.seaside |
|---|---|
| Message-ID | <CAPYvR9c41Vuj7tyvq4iq8uKiqMQoQhwysxtWTHH1dfSG6P6kTQ@mail.gmail.com> |
--===============8445348495561276584== Content-Type: multipart/alternative; boundary="00000000000010bda1062fd8eb55" --00000000000010bda1062fd8eb55 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Yes, all the widgets on the page are inside the form. On Sat, Mar 8, 2025 at 10:00=E2=80=AFAM Joachim Tuchel <jtuchel@objektfabri= k.de> wrote: > Carl, > > > Is your link inside of an die html Form? > > Joachim > > Am 08.03.2025 um 13:44 schrieb Carl G <[email protected]>: > > =EF=BB=BF > People expect to be able to treat anchors like buttons and not just as > links to another page. There should not be any functional difference in = a > modern web app. That is all I am trying to do. > > In older versions of Seaside I could just send submitFormNamed: with the > form name to an anchor, and this would do the trick. Nothing so simple > seems to exist in newer versions, and I cannot seem to make the form subm= it > before the callbacks happen on the widgets, so then values are lost on > those widgets. > > Or maybe my application is not configured with the correct libraries, or > something else? > > Thanks, > > -Carl > > > On Fri, Mar 7, 2025 at 11:13=E2=80=AFPM Jupiter Jones <jupiter.jones@mail= .com> > wrote: > >> Hi Carl, >> >> I=E2=80=99m not sure exactly what you=E2=80=99re wanting to achieve so t= o confirm: you >> want an anchor somewhere outside the form to trigger the submit action o= f a >> form. Is that right? >> >> Do you get an error when trying to send submit() to an Anchor? I assume >> that only a form can be submitted. >> >> If you want the anchor to submit a form somewhere else on the page you= =E2=80=99ll >> need javascript like: >> >> document.getElementById("myForm").submit(); >> >> You can just add a submit button to the form with: >> >> renderContentOn: canvas >> canvas submitButton >> callback: [ self doTheAction ]; >> with: self text >> >> But I assume you=E2=80=99ve done this a million times and I just don=E2= =80=99t understand >> what you=E2=80=99re wanting to achieve. :) >> >> On 8 Mar 2025, at 2:29=E2=80=AFpm, Carl G <[email protected]> wrote: >> >> >> 1. My attempts at submitting a form when an anchor is clicked so >> that it behaves like a button have been pretty hit or miss. >> I was able to do this in a much older version of Seaside without >> difficulty. I'm not sure if I'm not using the correct javascript lib= raries >> in my application's configuration. Clearly there must be a way to ma= ke it >> work, even if I need to write a little javascript to emulate the old >> behavior. >> >> 2. This is the code I am using. >> >> 3. anchor >> id: self id; >> class: self cssClass; >> callback: [ >> (html jQuery this closest: self director identifier) >> triggerSubmit. >> self triggerEvent: #linkClicked with: self >> ]; >> onClick: 'submit()'; >> with: self text >> >> 4. The javascript library I am using is JQuery.JQDepoloymentLibrary. >> I also was including WAToolFile, but that doesn't seem to make any >> difference. >> >> 5. Any thoughts appreciated. >> >> >> Thanks, >> >> -Carl Gundel >> http://runbasic.com >> _______________________________________________ >> seaside mailing list -- [email protected] >> To unsubscribe send an email to [email protected] >> >> >> _______________________________________________ > seaside mailing list -- [email protected] > To unsubscribe send an email to [email protected] > > --00000000000010bda1062fd8eb55 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Yes, all the widgets on the page are inside the form.</div= ><br><div class=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" clas= s=3D"gmail_attr">On Sat, Mar 8, 2025 at 10:00=E2=80=AFAM Joachim Tuchel <= ;<a href=3D"mailto:[email protected]">[email protected]</a>>= wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px = 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir= =3D"auto"><div dir=3D"ltr"></div><div dir=3D"ltr">Carl,</div><div dir=3D"lt= r"><br></div><div dir=3D"ltr"><br></div><div dir=3D"ltr">Is your link insid= e of an die html Form?</div><div dir=3D"ltr"><br></div><div dir=3D"ltr">Joa= chim</div><div dir=3D"ltr"><br><blockquote type=3D"cite">Am 08.03.2025 um 1= 3:44 schrieb Carl G <<a href=3D"mailto:[email protected]" target=3D"_= blank">[email protected]</a>>:<br><br></blockquote></div><blockquote = type=3D"cite"><div dir=3D"ltr">=EF=BB=BF<div dir=3D"ltr"><div>People expect= to be able to treat anchors like buttons and not just as links to another = page.=C2=A0 There should not be any functional difference in a modern web a= pp.=C2=A0 That is all I am trying to do.</div><div><br></div><div>In older = versions of Seaside I could just send submitFormNamed: with the form name t= o an anchor, and this would do the trick.=C2=A0 Nothing so simple seems to = exist in newer versions, and I cannot seem to make the form submit before t= he callbacks happen on the widgets, so then values are lost on those widget= s.</div><div><br></div><div>Or maybe my application is not configured with = the correct libraries, or something else?</div><div><br></div><div>Thanks,<= /div><div><br></div><div>-Carl</div><div><br></div></div><br><div class=3D"= gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Mar 7, 2025 at 1= 1:13=E2=80=AFPM Jupiter Jones <<a href=3D"mailto:[email protected]"= target=3D"_blank">[email protected]</a>> wrote:<br></div><blockquo= te class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px = solid rgb(204,204,204);padding-left:1ex"><div>Hi Carl,<div><br></div><div><= span style=3D"color:rgb(0,0,0)">I=E2=80=99m not sure exactly what you=E2=80= =99re wanting to achieve</span>=C2=A0so to confirm: you want an anchor some= where outside the form to trigger the submit action of a form. Is that righ= t?</div><div><br></div><div>Do you get an error when trying to send submit(= ) to an Anchor? I assume that only a form can be submitted.</div><div><br><= /div><div>If you want the anchor to submit a form somewhere else on the pag= e you=E2=80=99ll need javascript like:</div><div><span style=3D"color:rgb(0= ,0,0)"><br></span></div><div><span style=3D"color:rgb(0,0,0)">document.getE= lementById(</span><span style=3D"color:rgb(0,0,0)">"myForm"</span= ><span style=3D"color:rgb(0,0,0)">).submit();</span></div><div><br></div><d= iv>You can just add a submit button to the form with:</div><div><br></div><= div>renderContentOn: canvas</div><div>canvas submitButton</div><div><span s= tyle=3D"white-space:pre-wrap"> </span>callback: [ self doTheAction ];=C2=A0= </div><div><span style=3D"white-space:pre-wrap"> </span>with: self text</di= v><div><br></div><div>But I assume you=E2=80=99ve done this a million times= and I just don=E2=80=99t understand what you=E2=80=99re wanting to achieve= . :)</div><div><div><br><blockquote type=3D"cite"><div>On 8 Mar 2025, at 2:= 29=E2=80=AFpm, Carl G <<a href=3D"mailto:[email protected]" target=3D= "_blank">[email protected]</a>> wrote:</div><br><div><div dir=3D"ltr"= ><ol aria-label=3D"Messages in seaside" role=3D"list" style=3D"margin:0px;p= adding:0px;border:0px;font-family:"gg sans","Noto Sans"= ,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px;verti= cal-align:baseline;list-style:none;min-height:0px;overflow:hidden"><li id= =3D"m_-5232733346485510579m_2620444243200943940gmail-chat-messages-31141991= 8631305218-1347770725532041226" style=3D"margin:0px;padding:0px;border:0px;= font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:b= aseline;outline:none"><div role=3D"article" aria-labelledby=3D"message-user= name-1347770725532041226 uid_1 message-content-1347770725532041226 uid_2 me= ssage-timestamp-1347770725532041226" style=3D"margin-right:0px;margin-botto= m:0px;margin-left:0px;border:0px;font-weight:inherit;font-style:inherit;fon= t-family:inherit;vertical-align:baseline;outline:0px;min-height:2.75rem"><d= iv style=3D"margin:0px;padding:0px;border:0px;font-weight:inherit;font-styl= e:inherit;font-family:inherit;vertical-align:baseline;outline:0px"><div id= =3D"m_-5232733346485510579m_2620444243200943940gmail-message-content-134777= 0725532041226" style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;p= adding-top:0px;padding-right:0px;padding-bottom:0px;border:0px;font-weight:= inherit;font-style:inherit;font-family:inherit;font-size:1rem;vertical-alig= n:baseline;outline:0px;overflow:hidden">My attempts at submitting a =C2=A0f= orm when an anchor is clicked so that it behaves like a button have been pr= etty hit or miss. <br>I was able to do this in a much older version of Seas= ide without difficulty.=C2=A0 I'm not sure if I'm not using the cor= rect javascript libraries in my application's configuration.=C2=A0 Clea= rly there must be a way to make it work, even if I need to write a little j= avascript to emulate the old behavior.<br><br></div></div></div></li><li id= =3D"m_-5232733346485510579m_2620444243200943940gmail-chat-messages-31141991= 8631305218-1347770725532041226" style=3D"margin:0px;padding:0px;border:0px;= font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:b= aseline;outline:none"><div id=3D"m_-5232733346485510579m_262044424320094394= 0gmail-message-content-1347770725532041226" style=3D"margin-top:0px;margin-= right:0px;margin-bottom:0px;padding-top:0px;padding-right:0px;padding-botto= m:0px;border:0px;font-weight:inherit;font-style:inherit;font-family:inherit= ;font-size:1rem;vertical-align:baseline;outline:0px;overflow:hidden">This i= s the code I am using.<br><br></div></li><li id=3D"m_-5232733346485510579m_= 2620444243200943940gmail-chat-messages-311419918631305218-13477707255320412= 26" style=3D"margin:0px;padding:0px;border:0px;font-weight:inherit;font-sty= le:inherit;font-family:inherit;vertical-align:baseline;outline:none"><div i= d=3D"m_-5232733346485510579m_2620444243200943940gmail-message-content-13477= 70725532041226" style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;= padding-top:0px;padding-right:0px;padding-bottom:0px;border:0px;font-weight= :inherit;font-style:inherit;font-family:inherit;font-size:1rem;vertical-ali= gn:baseline;outline:0px;overflow:hidden">anchor<br>=C2=A0 =C2=A0 id: self i= d;<br>=C2=A0 =C2=A0 class: self cssClass;<br>=C2=A0 =C2=A0 callback: [<br>= =C2=A0 =C2=A0 =C2=A0 =C2=A0 (html jQuery this closest: self director identi= fier) triggerSubmit.<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 self triggerEvent: #lin= kClicked with: self<br>=C2=A0 =C2=A0 ];<br>=C2=A0 =C2=A0 onClick: 'subm= it()';<br>=C2=A0 =C2=A0 with: self text<br><br></div></li><li id=3D"m_-= 5232733346485510579m_2620444243200943940gmail-chat-messages-311419918631305= 218-1347770725532041226" style=3D"margin:0px;padding:0px;border:0px;font-we= ight:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline= ;outline:none"><div id=3D"m_-5232733346485510579m_2620444243200943940gmail-= message-content-1347770725532041226" style=3D"margin-top:0px;margin-right:0= px;margin-bottom:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;b= order:0px;font-weight:inherit;font-style:inherit;font-family:inherit;font-s= ize:1rem;vertical-align:baseline;outline:0px;overflow:hidden">The javascrip= t library I am using is JQuery.JQDepoloymentLibrary.=C2=A0 I also was inclu= ding WAToolFile, but that doesn't seem to make any difference.<br><br><= /div></li><li id=3D"m_-5232733346485510579m_2620444243200943940gmail-chat-m= essages-311419918631305218-1347770725532041226" style=3D"margin:0px;padding= :0px;border:0px;font-weight:inherit;font-style:inherit;font-family:inherit;= vertical-align:baseline;outline:none"><div id=3D"m_-5232733346485510579m_26= 20444243200943940gmail-message-content-1347770725532041226" style=3D"margin= -top:0px;margin-right:0px;margin-bottom:0px;padding-top:0px;padding-right:0= px;padding-bottom:0px;border:0px;font-weight:inherit;font-style:inherit;fon= t-family:inherit;font-size:1rem;vertical-align:baseline;outline:0px;overflo= w:hidden">Any thoughts appreciated.</div></li></ol><div><font face=3D"gg sa= ns, Noto Sans, Helvetica Neue, Helvetica, Arial, sans-serif"><span style=3D= "font-size:16px"><br></span></font></div><div><font face=3D"gg sans, Noto S= ans, Helvetica Neue, Helvetica, Arial, sans-serif"><span style=3D"font-size= :16px">Thanks,</span></font></div><div><font face=3D"gg sans, Noto Sans, He= lvetica Neue, Helvetica, Arial, sans-serif"><span style=3D"font-size:16px">= <br></span></font></div><div><font face=3D"gg sans, Noto Sans, Helvetica Ne= ue, Helvetica, Arial, sans-serif"><span style=3D"font-size:16px">-Carl Gund= el</span></font></div><div><font face=3D"gg sans, Noto Sans, Helvetica Neue= , Helvetica, Arial, sans-serif"><span style=3D"font-size:16px"><a href=3D"h= ttp://runbasic.com/" target=3D"_blank">http://runbasic.com</a></span></font= ></div></div> _______________________________________________<br>seaside mailing list -- = <a href=3D"mailto:[email protected]" target=3D"_blank">sea= [email protected]</a><br>To unsubscribe send an email to <a h= ref=3D"mailto:[email protected]" target=3D"_blank">s= [email protected]</a><br></div></blockquote></div><br= ></div></div></blockquote></div> <span>_______________________________________________</span><br><span>seasi= de mailing list -- <a href=3D"mailto:[email protected]" ta= rget=3D"_blank">[email protected]</a></span><br><span>To u= nsubscribe send an email to <a href=3D"mailto:[email protected]= ndation.org" target=3D"_blank">[email protected]</a>= </span><br></div></blockquote></div></blockquote></div> --00000000000010bda1062fd8eb55-- --===============8445348495561276584== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ seaside mailing list -- [email protected] To unsubscribe send an email to [email protected] --===============8445348495561276584==--