Jump to content

TWIRED

Caspio Ninja
  • Posts

    81
  • Joined

  • Last visited

  • Days Won

    1

Everything 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 Exampleoriginalimage.jpg (path) is stored in table 1 (file field)lets say fileID is : 0000If 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 changedoriginalimage_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. Thanks Mathilda, ".. a separate table for history of logs and then create a submission form and receive user's ID and other datapa from authentication fields, then add auto-submit script. After that, you may specify in authentication to redirect user to that datapage and then after form is submitted, redirect user to the user's dashboard. " it worked
  6. 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 !
  7. HI Diversity, As Mathilda mentioned, you have to hit "Source" button (in footer) and then paste the code in. Also, Hold down Control key when selecting from the listbox.
  8. 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.
  9. 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
  10. This might help... Pure JS http://stackoverflow.com/questions/28545509/display-image-thumbnail-of-image-selected-from-filepicker http://stackoverflow.com/questions/23598175/thumbnail-image-that-pop-when-selected-javascript JQuery/Lightbox Method http://www.lokeshdhakar.com/projects/lightbox2/?u=9
  11. 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
  12. 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';
  13. 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';
  14. Just my 2 cents, maybe a shared table , with the parameter values? can then be used witha view or as a lookup table? Thanks
  15. TWIRED

    Hi Jan,

    Could use your help

     

    Im trying to change the text of a label.

    script below doesnt work.

    I can get the id , but unable to replace the text.

     

    What am I doing wrong?

     

    Ive also loaded it onLoad , so that the html loads before the script,

    but it doesnt work

    Thanks !!

     

     

    var label=document.getElementsByTagName('input')[0].id;
    alert("label value=" +label);
    document.getElementById('label').innerText = 'Change The Label Text';

    1. TWIRED

      TWIRED

      Update

      I have managed to change

      -the label of a virtual field

      -label of an  input field

      -value of an input field

       

      All I need now is help updating the value of a virtual field text box.

       

      Thanks !

  16. 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.
  17. Heres a working model that works..(Just 2 datapages) http://www.tripatwork.com/test-searchsubmit-page.html user: guest@guest.com pass: guest
  18. AuthFields do get impacted. This baffled me for a while, I would rename or re-create fields in the table, and they would not be available or re-named in my javascript code (auth fields) The Trick is to go into your VIEW , and make sure the field is selected as well as re-name it IN THE VIEW. it then should be double checked in your javascript . Hope this helps someone~
  19. <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>
  20. Add A Header & Footer to Your DataPage. Javascript is generally put in the footer of the DataPage
  21. 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.
  22. Use calculated field functions 1) Use Cast to convert the number to a string, 2) select the string character using Left(string, number) 3) Use Cast to convert the string to a number. http://howto.caspio.com/function-reference/ hope it helps.
  23. 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 ~
  24. 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.
×
×
  • Create New...