Jump to content

csporcic

Members
  • Content Count

    9
  • Joined

  • Last visited

  1. I'm using the script below in a function to submit a Caspio submission form. else {document.getElementById('caspioform').submit();} The same function does not work in a "Single Record Update" datapage. Does anyone know the correct syntax to have a form Update instead of Submit? Thanks, Chris.
  2. I figured it out, here is the script. Chris. <script type="text/javascript"> function drop(){ document.getElementById('InsertRecordMaxQ').value = document.getElementsByName('cbParamVirtual2')[0].value; } document.getElementsByName('cbParamVirtual2')[0].onchange = drop; function ValidateNumbers(){ var v_maxqty = parseInt(document.getElementById("InsertRecordMaxQ").value); var v_pieces = parseInt(document.getElementById('InsertRecordQty').value); if(v_pieces > v_maxqty || v_pieces=="" || isNaN(v_pieces)) { alert("The pieces ordered cannot exceed the maximum quantity."); document.getElementById('InsertRecordQty').value = null; return false; } else {document.getElementById('caspioform').submit();} } </script> <input type="image" src="images/Step1.gif" height="22" width="280" onclick="ValidateNumbers()" value="Submit">
  3. Here is a link to the deployed datapage. I added some comments after a few of the fields. http://bridge.caspio.net/dp.asp?AppKey=d39010003c6f200f7e554a98b8cb The script works some of the time, but not all of the time. The alert message should only appear if the Qty is greater than the MaxQ, otherwise the form should submit. Thanks for looking into this, Chris.
  4. MayMusic, I just submitted another scripting topic called 'Scripting Question - Field Entry Validation". Any help would be greatly appreciated. Thanks, Chris.
  5. Here is another scripting question related to validating a field entry. The scenario is that users order products. There is a MaxQty field in the product table that identifies the maximum quantity that can be ordered of each product. The current script is listed below, which is broker into 2 parts. 1) Function "Drop" takes the value from a cascading dropdown field (Virtual2), which is the maximum order quantity for the item selected, and populates a text field called MaxQ with the same value. This function works correctly. 2) Function "ValidateNumbers" should compare the value in field "Qty" entered by the user with the value in field "MaxQ" determined by the selected product. It should display an error message when Qty is greater than MaxQ and prevent the form from submitting. This function is only allowing the form to submit when the Qty is equal to the MaxQ. It should allow the form to submit when the Qty is less than MaxQ, but it does not. Please review the code and let me know if you have any suggestions. Thanks, Chris. <script type="text/javascript"> function drop(){ document.getElementById('InsertRecordMaxQ').value = document.getElementsByName('cbParamVirtual2')[0].value; } document.getElementsByName('cbParamVirtual2')[0].onchange = drop; function ValidateNumbers(){ if (document.getElementById('InsertRecordQty').value >document.getElementById("InsertRecordMaxQ").value ) { alert("The pieces ordered cannot exceed the maximum quantity."); document.getElementById('InsertRecordQty').value = null; return false; } else {document.getElementById('caspioform').submit();} } </script> <input type="image" src="images/Step1.gif" height="22" width="280" onclick="ValidateNumbers()" value="Submit">
  6. MayMusic, thank you so much. The script works flawlessly. Have a great day. Chris.
  7. I'm looking for help with validating a date field on a submission form. If the user enters a value less than the current date, an alert message appears and the form will not submit. Please provide a javascript solution if you have used something like this in one of your applications. Thanks, Chris.
  8. Thanks, this appears to work correctly now!
  9. I'm looking for help with a script I have created to validate a field. The purpose of the script is to limit the maximum entry of a numeric text entry field based on a cascading dropdown which includes the maximum value for a particular product. The user selects the product from the dropdown, then enters the quantity they want to order. This quantity is limited by the product they select. Here is the script that has been placed in the footer of the datapage. The first part of the script populates text field Virtual3 with the value of the cascading dropdown field Virtual2. This script works fine. The second part of the script attempts to validate the entry in text field Qty with the limit established by Virtual3. This script is not working and only avoids the Alert message when Qty = Virtual3, not when Qty is less than Virtual3. Please review and let me know if you have any suggestions. <script> function drop(){ document.getElementById('cbParamVirtual3').value = document.getElementsByName('cbParamVirtual2')[0].value; } document.getElementsByName('cbParamVirtual2')[0].onchange = drop; </script> <script type="text/javascript"> function ValidateNumbers() { var max=document.getElementById('cbParamVirtual3').value; var qty=document.getElementById('InsertRecordQty').value; if(qty<1||qty>max) { alert("The pieces ordered cannot exceed the maximum quantity."); return true; } } document.getElementById('Submit').onclick = function() { if (!ValidateNumbers()) { this.submit(); } else { return false; } } </script> Thanks, Chris
×
×
  • Create New...