Jump to content

TWIRED

Caspio Ninja
  • Content Count

    81
  • Joined

  • Last visited

  • Days Won

    1

TWIRED last won the day on December 28 2016

TWIRED had the most liked content!

About TWIRED

  • Rank
    Advanced Member
  • Birthday May 7

Recent Profile Visitors

2,193 profile views
  1. 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 !

  2. Hey there!

     

    Thanks a lot for your reply on my  Limit the number of search by user?  post.

     

    Just a quick question. When you say:

     

    ==

    Every time a FreeUser logs in:

    - stamp the datetime in the "logindatetime" field.

     

    Everytime a FreeUser completes a search 

    -Increase the SearchCount with an increment of 1

     

    ==

     

    Do you mean that I have to do it manually everytime? Is there no way for it to be done automatically ?

    1. Show previous comments  3 more
    2. TWIRED

      TWIRED

      In the first Search submission page,

      you would have  a script - something like this in the footer

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

      <script>

      var maxsearchesallowed=5;


      var searchdate=[@authfield:A1_DUMMY_USER_AUTH_INFO_TABLE_DummyUserSearchDate*];

      var counter=0;
      var counter="[@authfield:A1_DUMMY_USER_AUTH_INFO_TABLE_DummyCount#]";

      var paiduser="[@authfield:A1_DUMMY_USER_AUTH_INFO_TABLE_DummyPaidUser]";

      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);
      searchdate=new Date(searchdate);

      counter=Number(counter)+1;

      //alert("received today= " +today);
      //alert("counter=" + counter);
      //alert("received searchdate= " +searchdate);

       

      function checkvalid() {

      if((today > searchdate) && (paiduser=="No" && Number(counter) < Number(maxsearchesallowed) ) )
      {
      alert("allow to search");


      document.getElementById("[@authfield:A1_DUMMY_USER_AUTH_INFO_TABLE_DummyUserSearchDate*]").value=today;

      document.getElementById("[@authfield:A1_DUMMY_USER_AUTH_INFO_TABLE_DummyCount#]").value=counter;
      //alert("counter="+counter);

      else
      {
      alert("sorry, you have exceeded your quota!");
      window.location("REDIRECT_URL_to_Anotherpage.html");
      return false;
      }
      }

      checkvalid();
      </script>

    3. TWIRED

      TWIRED

      Updated code that works...

      based on setup

       

      <script>

      var maxsearchesallowed=5;

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

      var paiduser="[@authfield:A1_DUMMY_USER_AUTH_INFO_TABLE_DummyPaidUser]";
      alert("paiduser= "+paiduser);

      //----------------------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;

      alert("today=  "+today);
      alert("searchdate= " + searchdate);


      //test
      //today=searchdate;

      function myFunction() 
      {
      if((today => searchdate) && (paiduser=="No" && Number(counter) < Number(maxsearchesallowed) ) )
      {
      alert("allow to search");
      document.getElementById("EditRecordDummyUserSearchDate").value=today;

      //counter=Number(counter)+1;
      document.getElementById("EditRecordDummyCount").value=Number(counter)+1;
      //alert("counter="+counter);

      else
      {
      alert("sorry, you have exceeded your quota!");
      window.location("http://www.tripatwork.com/sa-test-pages---2.html");

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

      </script>

    4. TWIRED

      TWIRED

      Heres a working model that works

       

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

       

      user: cherif@cherif.com

      pass : cherif

  3. 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");
  4. 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.
  5. Heres a great post on passing fields from virtual fields to regular fields. Hope this helps. <SCRIPT LANGUAGE="JavaScript"> function concatenate() { var x = document.getElementById("cbParamVirtual5").value; document.getElementById("InsertRecordSchoolName").value = x; } document.getElementById("caspioform").onsubmit=concatenate; </SCRIPT>
  6. Arts. Community. Events

    p  l  a  y  m  u  s  i  c  i  a  n

  7. 1 last thing.. when i used just else in the source / html footer could never get it to work. I dont know if its a bug. But when I used else if, it worked. Thanks
  8. Heres an example that works, - to check a checkbox based on input from a non-hidden field or element. <script type="text/javascript"> var tagidvalue ; tagidvalue=document.getElementById('InsertRecordTagID').value; if (tagidvalue !=='') { document.getElementById('InsertRecordTagEmpRegisteredTagInSystem').checked=true; document.getElementById('InsertRecordTagEmpIsTagRegistrant').checked=true; } else if (tagidvalue =='') { document.getElementById('InsertRecordTagEmpRegisteredTag
  9. Hi , you could try this.. var x; if (x =='') or (x !=='') The element must not be hidden for it to work. you have to trick it var newone; newone = document.getElementById('InsertRecordCHKBOX'); if (newone == null) { newone=0 } Hope this helps. Thanks
×
×
  • Create New...