Jump to content

Tonie

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Tonie

  1. Hello,

    I am just starting with Javascript, (I do program in other languages). I am trying to capture the situation where a user does not enter either a Primary or Secondary phone.  This is on a Submission page. I inspected the items and it had EditRecordPrimaryPhone on the page .I also tried InsertRecord, but nothing works. It doesn't look like the page is running the Javascript at all, and I don't know how to debug it. I added a message that I hoped I would see either way to try to check that the Javascript was running. I put the code in the Footer.  Are there ways of debugging?  

    Thanks

    Tonie

    <SCRIPT LANGUAGE="JavaScript">

    function checkPhones(){

    var p1 = document.getElementById("EditRecordPrimaryPhone").value;
    var p2 = document.getElementById("EditRecordSecondaryPhone").value;

    if(p1 == "" && p2 == ""){
      {
        window.alert('Please input at least one phone number');
        return false;
      }
    else
      {
        window.alert( p1 + '' + p2);
        return false;
      }
     }

    }

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

    </SCRIPT>

  2. I am trying to  pass fields with special characters such as a Hash(#) over query string?

    I am new to Javascript, but I copied the Javascript from the answer below, and it works fine on the first link of the grid, but all the rest of the links have the parent URL and none of the data. It is building the parameters properly for the first link. 

    I inspected the  broken link and I found:

    image.png.64ede1158ee18ae523fbc4c81e67a1f9.png

    Do I need a loop? or do I need to refer to the links I am trying to encode a different way than    document.querySelector(`#${link_id}`).href = `${base_url}?${params.join("&")}` 

    Is there a better way to build the links? I have 17 fields that I am adding to the array to build the links. 

    I would appreciate any help

     

     

  3. I need to ask another question about this. I don't know Javascript, but my links are not working because I have # in my addresses (for Apt Numbers).

    Could you explain how I can escape # characters. I understand it's %23 and that I have to use encodeURIComponent().

    This is my link

     

    <a href ="[@app:URL_2]?cid=[@field:ID]&fn=[@field:FirstName]&ln=[@field:LastName]&a1=[@field:Address1]&a2=[@field:Address2]&c=[@field:City]&z=[@field:ZipPostalCode]&p1=@field:PrimaryPhone]&p2=[@field:SecondaryPhone]&da1=[@field:Address1]&da2=[@field:Address2]&dc=[@field:City]&dz=[@field:ZipPostalCode]&dp1=@field:PrimaryPhone]&dp2=[@field:SecondaryPhone]&r=[@field:Route]&dn=[@field:DriverNote]&pa=[@field:PhysicalAssistanceComment]&rc=[@field:Rate_Cd]&m=[@field:MobilityDevice]&cbResetParam=1">[@calcfield:1#]<a>

    I am finding # in a1, a2, d1 d2.  I don't understand how to replace the  # in the code above.

    Thanks for any help

     

×
×
  • Create New...