NetTalk Central

Author Topic: NetWebForm Validation  (Read 3245 times)

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
NetWebForm Validation
« on: May 22, 2012, 05:35:07 PM »
Hi Bruce,

When validating a NetWebForm in the ValidateUpdate embed, the alert popup appears but then the form does not re-load successfully, the page is blank. I have tried two different validations:

(this one is for the older PopupErrorMessage NetWebSource procedure)
if LOC:Report = 0
  loc:invalid = 'LOC:Report'
  p_web.SSV('ErrorMessage','This is the error message')
  p_web.SetValue('retry','ReportSelector')
end

and

if LOC:Report = 0
  loc:invalid = 'LOC:Report'
  loc:alert = 'This is the error message'
  p_web.SetValue('retry','ReportSelector')
end

Am I doing something wrong?

Regards,
Trent
« Last Edit: May 22, 2012, 09:56:21 PM by trent »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: NetWebForm Validation
« Reply #1 on: May 22, 2012, 11:11:27 PM »
>> Am I doing something wrong?

apparently - but I guess I would need to see an example to determine what...

cheers
Bruce

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Re: NetWebForm Validation
« Reply #2 on: May 24, 2012, 12:56:34 AM »
An example would be great, but I can't seem to reproduce this issue in an example. What could cause the form to not load after validation has failed? Are there any specific settings that need to be turned on/off? I am not using immediate validation or dictionary validation, only coded validation which is exactly they way I wrote before.

Regards,
Trent

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: NetWebForm Validation
« Reply #3 on: May 24, 2012, 01:46:06 AM »
>> What could cause the form to not load after validation has failed?

literally anything I guess. there's no template option that I'm aware of that has a "do not work" effect.

you can debug what is happening in the usual way -
does the request get to the server...
does the server send a reply...
if the reply is asynchronous, is it xHtml complaint...
and so on.

If you can't make an example that fails, then the risk of me duplicating your problem is really really low....

Cheers
Bruce

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Re: NetWebForm Validation
« Reply #4 on: May 24, 2012, 08:45:52 PM »
Hi Bruce,

I found out what it was, I wasn't calling the form correctly from my html menu. I had:

<<li><<a href="IncidentReport">New Incident Report<</a><</li><13,10>

When I needed:

<<li><<a href="IncidentReport?insert_btn=insert">New Incident Report<</a><</li><13,10>

This is working for forms that are inserting data but what do I need to call a memory form that is not inserting any data so the validation works correctly and the form reloads if validation fails?

Regards,
Trent

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: NetWebForm Validation
« Reply #5 on: May 25, 2012, 12:48:05 AM »
does this mean you can make an example now?

cheers
Bruce

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Re: NetWebForm Validation
« Reply #6 on: May 26, 2012, 05:51:45 PM »
Yes I can, example attached. Steps to repeat error:

1) Run app.
2) Click 'Memory Form Validation Not Working' link.
3) Press 'Save' button. Page does not re-load.

Steps to fix:

1) Add a condition to the PageHeaderTag > xHTML > htmlMenu procedure (for example): p_web.PageName <> 'FIRSTFORM' and p_web.PageName <> 'MEMORYFORM'
2) Repeat above steps.
3) Page now does re-load correctly.

Not sure why this is. On my production app I already have a condition on the PageHeaderTag > xHTML procedure: p_web.GetSessionLoggedIn() and p_web.PageName <> 'LogoutForm'

Confusing!!  ??? ??? ??? Please help.

Regards,
Trent

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: NetWebForm Validation
« Reply #7 on: May 27, 2012, 10:00:26 PM »
you must include the dct with app examples. If I convert the web24 dict, it does not convert to the dict that your app is using. Each dict conversion is unique.

It's usually a good idea to include TPS files as well in the zip.

cheers
Bruce

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Re: NetWebForm Validation
« Reply #8 on: May 27, 2012, 10:12:13 PM »
Sorry Bruce, attached is everything.

Regards,
Trent

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: NetWebForm Validation
« Reply #9 on: May 28, 2012, 05:56:07 AM »
>>1) Run app.
>>2) Click 'Memory Form Validation Not Working' link.
>>3) Press 'Save' button. Page does not re-load.

um - page reloads here - I removed the condition from the page header tag and it still reloads when I click on "save".

Cheers
Bruce

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Re: NetWebForm Validation
« Reply #10 on: May 28, 2012, 01:43:19 PM »
So when there is no condition for htmlMenu the page reloads correctly for you? I have just tested again with the same app and the page does not reload. I've uploaded images showing what I see:

MemoryForm1: Before save button is pressed.
MemoryForm2: Save button pressed - validation occurs.
MemoryForm3: OK button on validation pressed and MemoryForm does not reload.

I've replicated it in two apps now and tested on multiple PC's so I know I'm not imagining it...

Regards,
Trent

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: NetWebForm Validation
« Reply #11 on: May 28, 2012, 09:24:17 PM »
ok, I see your problem. your htmlMenu procedure is a "NetWebPage" procedure, but you're embedding it inside the Header. Pages cannot be embedded inside other procedures, they are by definition the "page container".

Change htmlMenu to be a NetWebSource (and set the xHtml Location).

cheers
Bruce

trent

  • Full Member
  • ***
  • Posts: 204
    • View Profile
    • Email
Re: NetWebForm Validation
« Reply #12 on: May 28, 2012, 10:16:48 PM »
I should've known that, it's in the documentation :( Thank you for your help Bruce, glad this is an easy fix.

Regards,
Trent