Re: Making an anchor behave like a button
Joachim Tuchel <[email protected]> Sat, 8 Mar 2025 16:00:24 +0100
| Newsgroups | gmane.comp.lang.smalltalk.squeak.seaside |
|---|---|
| Message-ID | <[email protected]> |
--===============1242711437003252152== Content-Type: multipart/alternative; boundary=Apple-Mail-A28B3255-29E2-450C-950B-70B625B1FF38 Content-Transfer-Encoding: 7bit --Apple-Mail-A28B3255-29E2-450C-950B-70B625B1FF38 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=3D= utf-8"></head><body dir=3D"auto"><div dir=3D"ltr"></div><div dir=3D"ltr">Car= l,</div><div dir=3D"ltr"><br></div><div dir=3D"ltr"><br></div><div dir=3D"lt= r">Is your link inside of an die html Form?</div><div dir=3D"ltr"><br></div>= <div dir=3D"ltr">Joachim</div><div dir=3D"ltr"><br><blockquote type=3D"cite"= >Am 08.03.2025 um 13:44 schrieb Carl G <[email protected]>:<br><br>= </blockquote></div><blockquote type=3D"cite"><div dir=3D"ltr">=EF=BB=BF<div d= ir=3D"ltr"><div>People expect to be able to treat anchors like buttons and n= ot just as links to another page. There should not be any functional d= ifference in a modern web app. That is all I am trying to do.</div><di= v><br></div><div>In older versions of Seaside I could just send submitFormNa= med: with the form name to an anchor, and this would do the trick. Not= hing so simple seems to exist in newer versions, and I cannot seem to make t= he form submit before the callbacks happen on the widgets, so then values ar= e lost on those widgets.</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 gmail_quote_container"><div dir=3D"ltr" class= =3D"gmail_attr">On Fri, Mar 7, 2025 at 11:13=E2=80=AFPM Jupiter Jones <<a= href=3D"mailto:[email protected]">[email protected]</a>> wrote= :<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8= ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Hi Carl,<di= v><br></div><div><span style=3D"color:rgb(0,0,0)">I=E2=80=99m not sure exact= ly what you=E2=80=99re wanting to achieve</span> so to confirm: you wan= t an anchor somewhere outside the form to trigger the submit action of a for= m. Is that right?</div><div><br></div><div>Do you get an error when trying t= o send submit() to an Anchor? I assume that only a form can be submitted.</d= iv><div><br></div><div>If you want the anchor to submit a form somewhere els= e on the page 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)">doc= ument.getElementById(</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><div= >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 style= =3D"white-space:pre-wrap"> </span>callback: [ self doTheAction ]; = ;</div><div><span style=3D"white-space:pre-wrap"> </span>with: self t= ext</div><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 ac= hieve. :)</div><div><div><br><blockquote type=3D"cite"><div>On 8 Mar 2025, a= t 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"lt= r"><ol aria-label=3D"Messages in seaside" role=3D"list" style=3D"margin:0px;= padding:0px;border:0px;font-family:"gg sans","Noto Sans"= ,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px;vertic= al-align:baseline;list-style:none;min-height:0px;overflow:hidden"><li id=3D"= m_2620444243200943940gmail-chat-messages-311419918631305218-1347770725532041= 226" style=3D"margin:0px;padding:0px;border:0px;font-weight:inherit;font-sty= le:inherit;font-family:inherit;vertical-align:baseline;outline:none"><div ro= le=3D"article" aria-labelledby=3D"message-username-1347770725532041226 uid_1= message-content-1347770725532041226 uid_2 message-timestamp-134777072553204= 1226" style=3D"margin-right:0px;margin-bottom:0px;margin-left:0px;border:0px= ;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:b= aseline;outline:0px;min-height:2.75rem"><div style=3D"margin:0px;padding:0px= ;border:0px;font-weight:inherit;font-style:inherit;font-family:inherit;verti= cal-align:baseline;outline:0px"><div id=3D"m_2620444243200943940gmail-messag= e-content-1347770725532041226" style=3D"margin-top:0px;margin-right:0px;marg= in-bottom:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;border:0p= x;font-weight:inherit;font-style:inherit;font-family:inherit;font-size:1rem;= vertical-align:baseline;outline:0px;overflow:hidden">My attempts at submitti= ng a form when an anchor is clicked so that it behaves like a button h= ave been pretty hit or miss. <br>I was able to do this in a much older versi= on of Seaside without difficulty. I'm not sure if I'm not using the co= rrect javascript libraries in my application's configuration. Clearly t= here must be a way to make it work, even if I need to write a little javascr= ipt to emulate the old behavior.<br><br></div></div></div></li><li id=3D"m_2= 620444243200943940gmail-chat-messages-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_2620444243200943940gmail-message-content-1347770725532041226" style=3D"ma= rgin-top:0px;margin-right:0px;margin-bottom:0px;padding-top:0px;padding-righ= t:0px;padding-bottom:0px;border:0px;font-weight:inherit;font-style:inherit;f= ont-family:inherit;font-size:1rem;vertical-align:baseline;outline:0px;overfl= ow:hidden">This is the code I am using.<br><br></div></li><li id=3D"m_262044= 4243200943940gmail-chat-messages-311419918631305218-1347770725532041226" sty= le=3D"margin:0px;padding:0px;border:0px;font-weight:inherit;font-style:inher= it;font-family:inherit;vertical-align:baseline;outline:none"><div id=3D"m_26= 20444243200943940gmail-message-content-1347770725532041226" 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-f= amily:inherit;font-size:1rem;vertical-align:baseline;outline:0px;overflow:hi= dden">anchor<br> id: self id;<br> class: self cssC= lass;<br> callback: [<br> (html jQue= ry this closest: self director identifier) triggerSubmit.<br> &= nbsp; self triggerEvent: #linkClicked with: self<br> ];<= br> onClick: 'submit()';<br> with: self text<br><b= r></div></li><li id=3D"m_2620444243200943940gmail-chat-messages-311419918631= 305218-1347770725532041226" style=3D"margin:0px;padding:0px;border:0px;font-= weight:inherit;font-style:inherit;font-family:inherit;vertical-align:baselin= e;outline:none"><div id=3D"m_2620444243200943940gmail-message-content-134777= 0725532041226" style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;pa= dding-top:0px;padding-right:0px;padding-bottom:0px;border:0px;font-weight:in= herit;font-style:inherit;font-family:inherit;font-size:1rem;vertical-align:b= aseline;outline:0px;overflow:hidden">The javascript library I am using is JQ= uery.JQDepoloymentLibrary. I also was including WAToolFile, but that d= oesn't seem to make any difference.<br><br></div></li><li id=3D"m_2620444243= 200943940gmail-chat-messages-311419918631305218-1347770725532041226" style=3D= "margin:0px;padding:0px;border:0px;font-weight:inherit;font-style:inherit;fo= nt-family:inherit;vertical-align:baseline;outline:none"><div id=3D"m_2620444= 243200943940gmail-message-content-1347770725532041226" style=3D"margin-top:0= px;margin-right:0px;margin-bottom:0px;padding-top:0px;padding-right:0px;padd= ing-bottom:0px;border:0px;font-weight:inherit;font-style:inherit;font-family= :inherit;font-size:1rem;vertical-align:baseline;outline:0px;overflow:hidden"= >Any thoughts appreciated.</div></li></ol><div><font face=3D"gg sans, Noto S= ans, Helvetica Neue, Helvetica, Arial, sans-serif"><span style=3D"font-size:= 16px"><br></span></font></div><div><font face=3D"gg sans, Noto Sans, Helveti= ca Neue, Helvetica, Arial, sans-serif"><span style=3D"font-size:16px">Thanks= ,</span></font></div><div><font face=3D"gg sans, Noto Sans, Helvetica Neue, H= elvetica, Arial, sans-serif"><span style=3D"font-size:16px"><br></span></fon= t></div><div><font face=3D"gg sans, Noto Sans, Helvetica Neue, Helvetica, Ar= ial, sans-serif"><span style=3D"font-size:16px">-Carl Gundel</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"http://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">seasi= [email protected]</a><br>To unsubscribe send an email to <a href= =3D"mailto:[email protected]" target=3D"_blank">seasi= [email protected]</a><br></div></blockquote></div><br></di= v></div></blockquote></div> <span>_______________________________________________</span><br><span>seasid= e mailing list -- [email protected]</span><br><span>To unsu= bscribe send an email to [email protected]</span><br>= </div></blockquote></body></html>= --Apple-Mail-A28B3255-29E2-450C-950B-70B625B1FF38-- --===============1242711437003252152== 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] --===============1242711437003252152==--