Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Validation without JS

Featured Replies

I have to validate a field in a form, I beleive that my problem is not solvable with Javascript.

The form is a competition which all entrants only can apply once. And the only workable solution to that is to make sure that people can't enter with the same e-mail address twice. The form and format page have to check if someone tries to enter the competition twice (or more) with the same e-mail address.

I have javascript validation on all the required fields (such as name, phone ...) and I've tried to use the FMP control attributes on fields (such as: required value, not-empty and so on). But all that happens is that I can get the format page use the error code sent out by WC (code 504) and print: "You have already answered... you bastard", but the information with the same e-mail address is added to the database. The only difference is that it doesn't contain the duplicate e-mail address.

Is there anyway I can stop FMP from adding that post?

You can apply a 'Unique' validation in 'Define Fields' for the email field. When a duplicate is submitted and error will be returned.

Hope this helps.

Garry

Gary,

Won't that hang the server? I thought they popped up an error message on the server and hung there until someone clicked okay. That being an os9.x server of course.

Does this still happen in Unlimited?

Dan,

It shouldn't pop-up on the server if you are using WebCompanion (cdml). The error will be sent to the browser. Hence, you will be able to capture this with "-error".

Hope this helps.

Garry

FWIW, I just tested this concept on Internet Explorer. My -error page was not returned. Instead I got a pop-up window "Internet Explorer Script Alert" which had the message,

"Your attempt to edit a record failed because of the following:

"Not unique value on field "expire" "

I've just had a chance to do my own test with:

<form action="FMPro" method="post">

<input type="hidden" name="-db" value="combotest.fp5">

<input type="hidden" name="-lay" value="web">

<input type="hidden" name="-format" value="hworld2.html">

<input type="hidden" name="-error" value="fmperror.html">

<input type="hidden" name="-recid" value="[FMP-CurrentRecID]">

Field b1: <input type="text" name="my_rec_serial#" value="[FMP-Field: my_rec_serial#]">

<input type="submit" name="-edit" value="Edit"></form>

Here is the fmperror.html contents:

</head>

<body>

Error [FMP-CurrentError]

</body>

It is working OK for me; it returns error code 504. I am using FMP 5.5v2 on Mac OS X.

All the best.

Garry

  • 3 weeks later...
  • Author

It works great with [FMP-CurrentError] and som If-statements.

thx

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.