NetTalk Central

Author Topic: Error in template - 5.16  (Read 7195 times)

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Error in template - 5.16
« on: February 22, 2011, 02:10:28 PM »
Hi Bruce,

I couldn't make example 28 compile so i went to the template to check.
In NetWeb.tpw line 3279 pos 151 there's an apostropy that shouldn't be there.

Maybe it's missing somewhere else <g>

Peter

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: Error in template - 5.16
« Reply #1 on: February 22, 2011, 03:28:54 PM »
But wait, there's more.

When you've got an other button in a browse and this button has a url defined then the generated html is missing a semicolon. The code happens to be generated from the same template line as above.

I can't figure out how to fix this one. Probably you're html encoding it somewhere in the dll or something.

However, the resulting effect of this missing semicolon is that you get a 404 - so maybe this is related to the Page not found post below.

Peter

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: Error in template - 5.16
« Reply #2 on: February 23, 2011, 12:28:06 AM »
Hallo Peter,

Re-download and register again the template and all will be fine.

Robert

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Error in template - 5.16
« Reply #3 on: February 23, 2011, 12:53:06 AM »
the first issue is corrected in the current file - but the second I need to look into. I'll keep you posted.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Error in template - 5.16
« Reply #4 on: February 23, 2011, 03:53:03 AM »
I've added the ; to the code, but strictly speaking it's not necessary unless there is more JavaScript on the button.

If you want to try the fix there though, open your \libsrc\netweb.clw file, look for Window.Open, and change it to be the following;

!------------------------------------------------------------------------------
NetWebServerWorker.WindowOpen    Procedure(string pUrl, <String pTarget>)
  code
  if lower(sub(pUrl,1,6)) = 'mailto'
    return 'window.open(''' & clip(pUrl) & ''',''_self'');'
  elsif  omitted(3) or ptarget = '' or ptarget = '''''''' or ptarget = '_self'
    return 'location.href=' & self._MakeURL(pUrl)
  else
    return 'window.open(''' & self._MakeURL(pUrl) & ''',''' & clip(pTarget) & ''');'
  end

notice the <> turning into = on the line after code, and also the two "return" lines
that end in ;

cheers
Bruce


jorgemir

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • Email
Re: Error in template - 5.16
« Reply #5 on: February 23, 2011, 04:42:38 AM »
missing : in conditional expression
http://168.144.197.26:4321/PortadaPage?nsert_btn=Insert&
Line 1

Still error on Other Button.

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: Error in template - 5.16
« Reply #6 on: February 23, 2011, 05:30:24 AM »
Bruce,

I tried your fix in netweb.clw and it made the 404 go away. But I don't get the new page either. Nothing happens.

So I can confirm there's a problem with Other button.

Peter

PS. FWIW I've just compiled the exact same app in 5.09 - it compiles and runs flawlessly and the Other buttons work as expected!
« Last Edit: February 23, 2011, 08:28:37 AM by peterH »

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Error in template - 5.16
« Reply #7 on: February 23, 2011, 01:21:41 PM »
EDIT: It's a problem with not having double-quotes around the url, if the url has an equals sign in it.

Firebug shows that every time I click on one of my other buttons, I get the error: "invalid assignment left-hand side"

Pic following:



[attachment deleted by admin]
« Last Edit: February 23, 2011, 02:47:27 PM by Stu »
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Error in template - 5.16
« Reply #8 on: February 24, 2011, 01:04:58 AM »
The call to location.href is already inside double-quotes;

onclick="location.href=PrintStub?bob=one&amp;fred=two&amp;MAI__MailBoxNumber=3&amp;PressedButton=print_btn"

Cunningly, in JavaScript double-quotes or singgle-quotes can be used to deliminate a string. So instead of trying to insert double-quotes around the location.href setting, we can use single-quotes. So it becomes;

onclick="location.href='PrintStub?bob=one&amp;fred=two&amp;MAI__MailBoxNumber=3&amp;PressedButton=print_btn'"

To make this change in the current build, go to the netweb.clw file, windowOpen method. replace the location.href line there with;

return 'location.href=''' & self._MakeURL(pUrl) & ''''

This fix will obviously be in 5.17

cheers
Bruce

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Error in template - 5.16
« Reply #9 on: February 24, 2011, 03:43:54 AM »
Awesome sauce!
Cheers,

Stu Andrews

jorgemir

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
    • Email
Re: Error in template - 5.16
« Reply #10 on: February 24, 2011, 06:03:40 PM »
I'm trying to use Other button to insert data from one table into a different table. Now that Other button works, I see that I can not get the p_web.GSV('Field') that contains (suposedly) the row id that Other exports to the form. Or I'm doing the wrong thing.
I use
Pro:codigo=p_web.gsv('Pro:codigo')  ! Being Pro:Codigo the key field of the browse table
if access:productos.fetch(Pro:codkey)
else
    p_web.ssv('Codigo',clip(pro:codigo))
    p_web.ssv('Descripcion',clip(pro:descripcion))
    p_web.ssv('PVP',clip(pro:pvp)
end

Now, this is coded in After Opening Files. Nothing comes from the row id and nothing is readed from the file

am I wrong?

Thanks
Jorge

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Error in template - 5.16
« Reply #11 on: February 24, 2011, 07:41:35 PM »
Jorge, can you move this to it's own thread please?