Jump to content
  • 0

Web Form- Data Validation-Running Totals


adfga

Question

ArrowNew Web Form job is to collect my score as I shoot an archery round that consists of shooting 3 arrows called an end. Going down range score using ArrowNew Web Form. Return to shooting line and do it again until match is over. So usually 10 to 20 rounds.

 

I am new to all this. But I did go thru videos and forum and that worked up to a point but now I am stuck.

Problem:

 

Form adds arrow score for end and will add to cumm and increase end by 1 as I go along but they only appear for a second and then replaced by new form. So I have to use back button each time to see results. Not sure to how make page move ID, target, cumm and end count to new form and clear last arrow value

 

Second problem but not as big as one. is arrow value validation an arrow can not have a value greater than 10. and I have tried Rules and javascript but I don't have the coding skill to get this simple task done. So asking for help.

 

To run go to:   adfga.ca/test.php 

 

This is the coding I added to footer. had to attach files cause paste doesn't work

 

ok I did say I am no expert on any of this. But I have a championship Shoot coming up and wanted to take this live.

 

 

 

SCRIPT LANGUAGE.pdf

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hello adfga,

 

Welcome to Caspio forum!

 

You can deploy two or three DataPages on your webpage, for example, you can read this article or see this video.

You can add the following script to the Footer (please do not forget to click the Source button):

<SCRIPT LANGUAGE="JavaScript">
function check_field()
 {
   var fieldname = "integer";
   var max = 10;
   var min = 1;
   var myMessage = "Enetered value should be more then 0 and less then 11";

   fieldname = "InsertRecord" + fieldname;
   var intmyValue = 0;
   var myValue = document.getElementById(fieldname).value;
   if (myValue.length > 0)
      intmyValue = parseFloat(myValue);
   else intmyValue = 0;
   if ((intmyValue>max)||(intmyValue<min))
     {
      alert(myMessage);
      return false;
      }
 }
document.getElementById("caspioform").onsubmit=check_field;
</SCRIPT>

Please, enter the name of your field instead of "integer"; enter your values of max, min and message.

I hope, it helps.

Link to comment
Share on other sites

  • 0
<SCRIPT LANGUAGE="JavaScript">
function check_field()
 {
   var fieldname = Arrow1;
   var max = 10;
   var min = 1;
   var myMessage = "Entered value should be more then 0 and less then 11";

   fieldname = "InsertRecord" + fieldname;
   var intmyValue = 0;
   var myValue = document.getElementById(fieldname).value;
   

   if (myValue.length > 0)intmyValue = parseFloat(myValue);
   else intmyValue = 0;
   if ((intmyValue>max)||(intmyValue<min))
     {
      alert(myMessage);
      return false;
      }
 }
document.getElementById("caspioform").onsubmit=check_field;
</SCRIPT>

Hi Caspio Evangelist

 

I created a new Data Page same data none of my java scrip.t I added Header & Footers and added your code. Replacing "Interger" with Arrow1 (database name & name on form) It did not return myMessage. Was there anywhere else I should have changed fieldname?

 

Also is this checking the length or value? I want to check value of 10 like $10 not how many digits entered. Not sure I was clear on my post. A real Newby.

 

I reviewed video and yes I have a one to many relationship. Archers(parent) Arrow(child) shot. The tables are setup this way. before Caspio I ran this in Microsoft access.

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
Answer this question...

×   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...