Jump to content

TWIRED

Caspio Ninja
  • Posts

    81
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by TWIRED

  1. If its a result page,

    You could put the code below in the header(Source)

     

    authentication needs to be enabled.

    change the "http://.." to the appropriate URL.

    Hope this helps..

     

    <div id="myDiv1"></div>
    <SCRIPT LANGUAGE="JavaScript">

    var myDiv1 = document.getElementById("myDiv1");
    var branchtype ='[@authfield:Staff_List_Branch_Type]';

    //alert(branchtype);
       
    if (branchtype=='FS')

    {

    myDiv1.innerHTML = "<b><h3><a href=\"http://www.google.com\">Google</a></hr></b>";

    }


    else if (branchtype =='SIS')

    {

    myDiv1.innerHTML = "<b><h3><a href=\"http://www.amazon.com\">Amazon</a></hr></b>";
    }

    </script>

  2. Hey abelphathot,

    this might help..

    In your original post, if its a checkbox



    <SCRIPT LANGUAGE="JavaScript">
     
    function Updatestatus()
    {
    if (document.getElementById("approved").checked==true)
    {
    document.getElementById("status")="approved";
    }
    else if (document.getElementById("approved").checked==false)
    {
    document.getElementById("status")="pending";
    }
    document.getElementById("caspioform").onsubmit= Updatestatus;
     
    </SCRIPT>

     

    you need to change to

     
    function Updatestatus()
    {
    if (document.getElementById("approved").checked=true);
    {
    document.getElementById("InsertRecordstatus")="approved";
    }
    else if (document.getElementById("approved").checked=false);
    {
    document.getElementById("InsertRecordstatus")="pending";
    }
    document.getElementById("caspioform").onsubmit= Updatestatus;
     
    </SCRIPT>

     

    change from "==" to =

    and

     

    you were also missing some semicolons :)

     

    Best ~

     

     

     

  3. Thanks for taking the time !

     

    Will try the site account settings in the URL format.

    finally figured out what the problem is after many hours of messing around .

    Heres what I found out

    Example
    originalimage.jpg (path) is stored in table 1 (file field)
    lets say fileID is : 0000

    If the filefield  is set to : Upload New File / (Automatically create a unique name) 
    And,If a user uploads a file with the SAME NAME ,
    originalimage_1.jpg is created 

    but the Original Image fileID NOW will change  : 

    originalimage.jpg : 0001 << increased by1 and changed
    originalimage_2.jpg : 0002

     

    This was what was breaking the URL 

    https://c2eku181.caspio.com/dpImages.aspx?AppKey=xxxxxxxxxx&file=/IMAGES_/TRIPATWORK/TESTIMAGES/spiderman.jpg

    so basically the URL becomes invalid , because it is tied to the fileID of the image.

    when the fileid changes, the url cannot find the image because it is still tied to the original file id

     

     

    Thanks for the zapier tip, will try it out and seems like a great way to store images with aws..

     

    Best !!~

  4. These type of urls , used to work flawlessly

    https://c2eku181.caspio.com/dpImages.asp?AppKey=ff384000f093d12f0cad40eab055&file=/IMAGES_/TRIPATWORK/TESTIMAGES/spiderman.jpg

     

    Last night it stopped working.

    it gives "File or Directory Not Found" error

     

    We use this type of display of images a lot with our apps.

    any idea why???

     

    Update 

    It seems to be something to do with the fileID changing.

    If a field is set to : Upload New File / (Automatically create a unique name) 

    1) a user uploads a file abc.jpg the first time.
    2) when the user uploads a file :- again with the same name,
    The URL link to the original abc.jpg does not work - because the fileid changes.

    Im assuming this happens because at caspios backend , the fileid is referred to when the url is parsed.

     

     

  5.  

     

    Just some pointers:)

    ----------------------------

    1) One cannot copy a file or image to another table, just by code on the front end (lets say javascript) . Its because of security reasons its disallowed.

    There has to be user intervention (choose and submit) by the user to do that.

    2) in caspio, images/files are not actually stored in the table,

    A file or image is actually stored in a folder (>> All Assets , Click on Files)

    >> ONLY a URL Link or path to the file is stored in the table field

     

    So basically , you dont need to "copy" the image over.

    *if you want to, you can copy the path to the image, in another tables field . The copied-to field must be a text field.

     

    After Submission of the saved image,

    whenever you want to reference the image , do so with a view (which has both tables)

     

    So if you create a relationship/Join between the 2 tables.

    -------------------------------------------------------------------------------------------

    Table 1                                         Table 2

    Table1ID (autonumber)           Table2ID (autonumber)

                                                          Table1FKID (Integer)   << Foreign Key Join

    Table1  (Table1ID)  >>One to Many >> Table2 (Table1FKID)

     

    Create a View

    ------------------------

    Inner Join

    Table1  (Table1ID)  >>One to Many >> Table2 (Table1FKID)

     

    Results or Report data Page (Referencing the saved image from Table 1 : in reports from other tables)

    ---------------------------------------------

     

    Use the View above as Data Source.

     

    Heres a working demo

    http://www.tripatwork.com/tagnt-test-2.html

     

     

    If you need any help, let me know...:)

    Thanks !

     

     

     

  6. This might work....

     

    Create a View with Both Tables

    - the table/field that will be updated , make editable

     

    Choose the view as datasource in the submission form

     

    Use the Resizer option

     

    in File Field Name , give it the field name you want to copy to.

     

    And, Instead of giving resized options, you could just give it the same width and height as the original.

     

     

    attached pic below.

     

     

    Save_Image_In_Another_Field.JPG

    Resizer_Options.JPG

  7. 16 hours ago, diversity said:

    Definitely not working for me.   I posted this in the Footer and changed the "InsertRecordMultiListbox" for my field but still only selects one item. 

    Hi Diversity,

    If yourlistbox field name is say, "LSTBOX", then you need to :- change it at both places in the script ,

    in your submission form (in footer - configure fields section)  to InsertRecordLSTBOX

    If its an update form then change to EditRecordLSTBOX

     

    Destination of Submission form : Same Form

     

    Heres a live working example:

    http://www.tripatwork.com/test-multilistbox-submit.html

     

    also attached is my settings for the listbox field element

     

    It definitely works, and it works well !

     

    Hope this helps:)

     

    Thanks

     

     

    Listbox_Element_Setting.JPG

    ListboxTable_Field.JPG

    MultiListbox_Form_selected.JPG

    Listbox_Element_Advanced_Setting.JPG

    Lookup_Table_for_Listbox.JPG

  8. This seemed to work for me.

    After messing around with it a bit.

     

    The trick in the submit form , the destination , do not use "Same Form" opton

    Use "Go to New Page" and enter the URL of the results datapage

     

    Also..

    In the Submit form

    ----------------------
    add < ahref="url?cbResetParam=1 > New Search</a> in Header
    destination : url of results page ( do not use "same Form" option !!)
    in dropdowns , make sure the onload external parameters is checked and entered.
    This will keep the drop downs in place after every submission.
     
     
    results page
    do not add search form links in results and details wizard options, leave it blank
  9. Just wanted to share this. Hope it helps somebody.

     

    solution to change the value of a label of a particular element in a form (Javascript):

    ------------------------------------------------------------------------------------------------------------

    var labels = document.getElementsByTagName('label');

    // 'label' is passed as the argument. To get this argument, First inspect the form element TYPE name in Chrome.

     

    for (var i = 0; i < labels.length; i++) {

       if (labels.htmlFor != '') {

            var elem = document.getElementById(labels.htmlFor);

            if (elem)

               elem.label = labels;         

       }

    }


    document.getElementById('EditRecordDummyCount').label.innerHTML = 'Label text is changed';

  10. What I was looking to do was :

    change the value of a label (of a particular element) in a form.

    figured it out. Thanks !

     

    Qtn : Using Javascript, is it possible to change the value of a >>  Virtual Field ? If so, How ????

     

     

    solution to change the value of a label of a particular element in a form:

    ------------------------------------------------------------------------------------------------------------

    var labels = document.getElementsByTagName('label');

    // 'label' is passed as the argument. To get this argument, First inspect the form element TYPE name in Chrome.

     

    for (var i = 0; i < labels.length; i++) {

       if (labels.htmlFor != '') {

            var elem = document.getElementById(labels.htmlFor);

            if (elem)

               elem.label = labels;         

       }

    }


    document.getElementById('EditRecordDummyCount').label.innerHTML = 'Label text is changed';

     

     

  11. On 10/24/2016 at 0:57 PM, shannonjwright said:

    Hello,

    I have been working on this issue for weeks now and I have even contacted Caspio and scheduled two expert sessions and the issue has not been resolved. I am trying to limit the number of people who can sign up for a training on our website. So if the limit for a training is 15, after the 15th person signs up, I want that training to close and people to no longer be able to sign up for it. I was directed to this url http://howto.caspio.com/tech-tips-and-articles/advanced-customizations/how-to-limit-the-number-of-submissions/. I have set up all this to the best of my ability. My problem is that when my submission form is redirected to my single update form, there is a blank webpage. So to our individuals who are signing up, it could almost appear that they didn't sign up. I have tried everything and I'm thinking it could have something to do with parameters? It is set up that you have to have authentication, it is set up with a unique ID, which is eventid, and I did have it where <div style="display:none;"> this html was in the header. Once I took this away, it displays no records found. I have the header saying Thank you for registering, but no records found is displayed underneath that sentence. I have no clue what to do and I am stuck. I've attached what the  the page with no records found looks like.  Please help!

     

     

    Untitled.png

    That would be most probably because the authentication and the Update Page Authentication has not been set up correctly.

    Mess around with >>> Web Form Wizard - Record Identification on the Update Page .

    I had the same issue and switched it to "find record through Record Level Security" , then I chose

    Identity field in Authentication: : AUTHID 

    Matching field in current data source  : AUTHID

     

    and it worked.

     

    If you choose :  Find record through unique ID 

    and have a unique email in the table , then you can match the emails vs the authid( autonumber).

    If you are using unique email for Authentication, then go to the AUthentication Data Page

    choose the email, go to Advanced and ON Exit , Check it. Note the email field

     

    and use the SAME field in >>  Find record through unique ID 

     

    The Other reason could be if in the Update Page

    Search and Report Wizard - Select Filtering Fields

     

    You have more than 1 filtering field that does not match up.

    Hope this helps.

     

     

     

  12. <script type="text/javascript">

    var maxsearchesallowed=5;

    var counter=0;
    var counter="[@field:DummyCount#]";

    var paiduser="[@field:DummyPaidUser^]";

    var searchpermitted=document.getElementById("EditRecordDummySearchPermitted").value;
    //alert("searchpermitted= "+searchpermitted);
    //alert("counter="+counter);

    //----------------------today date format---

    var today = new Date();
    //alert(today);
    var dd = today.getDate();
    //alert("todays date= " + dd);
    var mm = today.getMonth()+1; //January is 0!
    //alert("todays month= " + mm);

    var yyyy = today.getFullYear();
    if(dd<10){
        dd='0'+dd;

    if(mm<10){
        mm='0'+mm;

    var today = mm+'/'+dd+'/'+yyyy;

    //today=new Date(today);

    var searchdate=document.getElementById("EditRecordDummyUserSearchDate").value;

    //test
    //today=searchdate;

    function myFunction() {
    //alert("today=  "+today);
    //alert("searchdate= " + searchdate);
    //alert("paiduser= "+paiduser);

    if((today => searchdate) && (paiduser=="No" && Number(counter) < Number(maxsearchesallowed) ) )
    {
    alert("allow to search");
    document.getElementById("EditRecordDummyUserSearchDate").value=today;
    document.getElementById("EditRecordDummyCount").value=Number(counter)+1;
    document.getElementById("EditRecordDummySearchPermitted").checked=true;

    //alert("counter="+counter);

    else
    {
    alert("sorry, you have exceeded your quota!");
    document.getElementById("EditRecordDummySearchPermitted").checked=false;
    document.getElementById("cbParamVirtual2")[0].value="http://www.tripatwork.com/test-searchsubmit-page.html";
    return false;
    }

    }


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

    </script>

  13.  

    submission will cancel the redirect or vice versa.

    Dont put code on the submit button but do it in the onsubmit, secondly return false to stop the submission

    function redirect() {
      window.location.replace("login.php");
      return false;
    }

    using

    <form name="form1" id="form1" method="post" onsubmit="return redirect()">  
      <input type="submit" class="button4" name="order" id="order" value="Place Order" >
    </form>

    Or unobtrusively:

    window.onload=function() {
      document.getElementById("form1").onsubmit=function() {
        window.location.replace("login.php");
        return false;
      }
    }

    using

    <form id="form1" method="post">  
      <input type="submit" class="button4" value="Place Order" >
    </form>

     

    use

    window.location.replace("login.php");

    or simply window.location("login.php");

    It is better than using window.location.href =, because replace() does not put the originating page in the session history, meaning the user won't get stuck in a never-ending back-button fiasco. If you want to simulate someone clicking on a link, use location.href. If you want to simulate an HTTP redirect, use location.replace.

  14. Only 2 Datapages Required (No autosubmit hidden page) Solution.

    Ive tested and created a working model of a search

    which restricts the search based on:

    1) Within 24 hours  :  allowed

    2) Maximum searches : 5

     

    Its slightly tricky but works beautifully .

    It requires

    1) setting up the tables correctly,

    2) creating a view  

    3) and some javascript code in the submit datapage.

     

    Demo here

    http://www.tripatwork.com/test-searchsubmit-page.html

     

    user : guest@guest.com

    pass : guest

     

    Thanks ~

     

     

     

     

     

     

  15. 1)Javascript (or even jquery) is very important.

    2) knowing Css helps too. 

    3) knowing sql (not for implementation but for concepts) and database design is necessary for large complex

    apps and designing your app.

     

    Its all javascript mainly on front end.

     

    Caspio supports client side lanquages: HTML, CSS and Java Script in HTML block in a datapage. Also you may connect frameworks like JQuery or Bootstrap. 

    Regarding other languages or technologies, you may use their API in a webpage or application. 

  16. That sounds great. 

    Looks like you created a " 1 to Many " Table Relationship :  

    Parent (User) - Child (Projects) Relationship which makes sense.

    1 (User) -to - Many (Projects) Relationship.

    By creating this relationship, a user Id would be stored with  each project in the Projects table.

     

    If multiple users can be in and have multiple projects,

    or in other words a single project CAN have multiple Users,

    then you would require a many-to-many relationship.

    Example : 3 Tables (Many to many)

    Users >> UserProjects << Projects

     

    Im guessing what your trying to do is:-

    1)Only Some of  your users would have a "Managerial" role,

    -A Manager is one who can view ,edit and access everybody elses records and stuff .

    2) When This Manager User logs in , he would interact with all projects in the table.

    Others would not.

     

     

     

    Since there are 2 types of Users 

    a) Can login in and search and manage only their own Projects ( Role : Basic)

    b )  Can login and search, view,  and manage everybody elses projects  (Role : Managers)

     

    If there are many features besides just a search that makes the users experience different.

    Then I would recommend Re-Directing the logged in User based on His "Role"

     

     

     

     

    Best ~

     

     

     

     

     

     

     

     

     

     

     

     

×
×
  • Create New...