|
The cheap solution would be to simply put a try-catch around the if statement as if it is blank then it ain't an 'X' ! <%try{if(SCRN01.getFieldValue("SELPO").charAt(0)=='X'){%>SELECTED<%}}catch(Throwable t){}%> Otherwise you could check to see if the field is non-blank before getting the first char. Mike Mike Hockings, P.Eng. WebSphere Development Tools for AS/400 - CODE/Designer & WebFacing ! IBM Canada Ltd. Laboratory hockings@xxxxxxxxxx voice 905 413 3199 "Mark Giordano" <mgiordano@xxxxxxxxxxxxxxxxxxx> Sent by: wdsci-l-bounces@xxxxxxxxxxxx 2004-10-06 15:37 Please respond to Websphere Development Studio Client for iSeries To "Websphere Development Studio Client for iSeries" <wdsci-l@xxxxxxxxxxxx> cc Subject Re: [WDSCI-L] Radio Button Troubles That worked but when I added the same thing for the other button when I come back to the screen I get the following: javax.servlet.ServletException: String index out of range: 0 It seems to have a problem with with one of the values being blank. Any suggestions? ----- Original Message ----- From: "Mike Hockings" <hockings@xxxxxxxxxx> To: "Websphere Development Studio Client for iSeries" <wdsci-l@xxxxxxxxxxxx> Sent: Monday, October 04, 2004 2:55 PM Subject: Re: [WDSCI-L] Radio Button Troubles > It always seems kinda dicey to me to reference things in javascript, plus > the fact that it can cause the screen to change as it is being rendered. > Why not try and resolve things on the server when possible and avoid the > js. I don't know if the syntax is exactly right but I think you can see > what I'm getting at. > > <INPUT TYPE="radio" > NAME="POPUR" > onClick="set_trans_opt(l1_SCRN01$SELPO,l1_SCRN01$SELPRT,'X', ' > ');" > <%if(SCRN01.getFieldValue("SELPO").charAt(0)=='X'){%>SELECTED<%}%> > > >PO #<BR> > > Mike > > > Mike Hockings, P.Eng. > WebSphere Development Tools for AS/400 - CODE/Designer & WebFacing ! > IBM Canada Ltd. Laboratory > hockings@xxxxxxxxxx > > > > > "Mark Giordano" <mgiordano@xxxxxxxxxxxxxxxxxxx> > Sent by: wdsci-l-bounces@xxxxxxxxxxxx > 2004-10-04 14:29 > Please respond to > Websphere Development Studio Client for iSeries > > > To > <wdsci-l@xxxxxxxxxxxx> > cc > > Subject > [WDSCI-L] Radio Button Troubles > > > > > > > I would like a radio button selected by default when the page loads > and then keep either the original selection or the new selection when the > page reloads. I tried using the keyword CHECKED within the Html tag but > it > always selcted that value. I added the following script to hold the value > after it was selected before the radio buttons were defined: > > if (l1_SCRN01$SELPO.value == 'X') document.SCREEN.POPUR[0].checked = true; > if (l1_SCRN01$SELPRT.value == 'X') document.SCREEN.POPUR[1].checked = > true; > > After adding this the page did not behave as it was supposed to. Normally > I > would choose between an option and then hit Enter. It would then search > by > the appropriate selection criteria. Adding those above statements changed > that. When I take them out it works fine but I have to always select a > radio button. I used the following code below when setting up radio > buttons > within my application. Thanks. > > Mark Giordano > > <SPAN class="wf_default wf_field"> > <INPUT TYPE="radio" NAME="POPUR" > onClick="set_trans_opt(l1_SCRN01$SELPO,l1_SCRN01$SELPRT,'X', ' ');" >PO # > <INPUT TYPE="radio" NAME="POPUR" > onClick="set_trans_opt(l1_SCRN01$SELPO,l1_SCRN01$SELPRT,' ','X');">Part > No. > </SPAN> > > The function set_trans_opt is as follows: > > function set_trans_opt(field1,field2,value1,value2){ > > field1.value = value1; > > field2.value = value2; > > setFocusAndValue(field1,value1) > > setFocusAndValue(field2,value2)} > _______________________________________________ > This is the Websphere Development Studio Client for iSeries (WDSCI-L) > mailing list > To post a message email: WDSCI-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/wdsci-l > or email: WDSCI-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/wdsci-l. > > _______________________________________________ > This is the Websphere Development Studio Client for iSeries (WDSCI-L) mailing list > To post a message email: WDSCI-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/wdsci-l > or email: WDSCI-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/wdsci-l. _______________________________________________ This is the Websphere Development Studio Client for iSeries (WDSCI-L) mailing list To post a message email: WDSCI-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/wdsci-l or email: WDSCI-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/wdsci-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.