Jump to content

Validating a Field


Recommended Posts

On a submission form I have a required field that needs to contain a code from the sponsor of the person signing up. I have made the field required but I also need to make sure it is valid by checking the database to make sure it already exists. What is the best way to accomplish this?

Thanks

Link to comment
Share on other sites

On 7/27/2017 at 7:49 AM, gbecker said:

On a submission form I have a required field that needs to contain a code from the sponsor of the person signing up. I have made the field required but I also need to make sure it is valid by checking the database to make sure it already exists. What is the best way to accomplish this?

Thanks

Hello gbecker,

I would suggest creating a separate table with promotion codes and use this table as a Lookup table in your Submission form.

You should add a Virtual field to your Submission Form and use Cascading form element in order to retrieve a value from the Lookup table.

You may use HTML blocks to hide the Virtual field from your users as described in this article. You can use my JS code example below as a reference:

<SCRIPT LANGUAGE="JavaScript">
function myFunction(){
var v = document.getElementsByName("cbParamVirtual2")[0].value;
   if(v)
     {

return true;

     }

else {

alert("Wrong code");
return false;

     }
}

document.getElementById("caspioform").onsubmit=myFunction;

</SCRIPT>

 

Link to comment
Share on other sites

On 7/30/2017 at 6:52 AM, gbecker said:

Thank you Vitalikssssss.. I will give this a try. One question, how to I automate the process of adding new signups to the Lookup Table. Is there a way to add someone to the Lookup after they have signed up?

 

 

3

Please provide the details of your workflow.

Perhaps, you can use GUID datatype to generate the promotion code automatically in lookup table.

GUID A system-generated and globally-unique identifier value, typically used as a complex unique value.

 

Data-types

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...