I have two form submit buttons but I only want one is it possible to hide the other one ?

23 views
Skip to first unread message

Silvian Cedru

unread,
Sep 4, 2022, 11:00:25 PMSep 4
to web2py-users
Hello everyone, I think I have an issue that can not be resolved that easy to be quite honest I have a custom form and an post form on the same page my issue is I think I made a mistake with the design since it is all in between tabs see screenshot attached.

So my question would be is there a better solution or should I restyle the whole page ? 

Here is the code aswell for reference :

    <div id="Activity" class="tabcontent">
      {{if len(activities_project):}}
        <h2>Activity </h2>
        <br/>
        <p>
        {{for activity in activities_project:}}
          <p>{{=projects.project_name}} says <i>{{=activity.body}} Posted on {{=activity.created_on}} by {{=activity.created_by.first_name}}
            {{=activity.created_by.last_name}}</i>
          </p>
        {{pass}}
        </p>
      {{else:}}
        <h2>No comments posted yet</h2>
      {{pass}}
      {{=form_activity}}
    </div>
    {{=form.custom.submit}}
    {{=form.custom.end}}
   
 


screenshot.PNG

Dave S

unread,
Sep 6, 2022, 2:21:41 AMSep 6
to web2py-users
On Sunday, September 4, 2022 at 8:00:25 PM UTC-7 silvia...@gmail.com wrote:
Hello everyone, I think I have an issue that can not be resolved that easy to be quite honest I have a custom form and an post form on the same page my issue is I think I made a mistake with the design since it is all in between tabs see screenshot attached.

So my question would be is there a better solution or should I restyle the whole page ? 


In the code below, I don't see where you start the form.
 
Here is the code aswell for reference :

    <div id="Activity" class="tabcontent">
      {{if len(activities_project):}}
        <h2>Activity </h2>
        <br/>
        <p>
        {{for activity in activities_project:}}
          <p>{{=projects.project_name}} says <i>{{=activity.body}} Posted on {{=activity.created_on}} by {{=activity.created_by.first_name}}
            {{=activity.created_by.last_name}}</i>
          </p>
        {{pass}}
        </p>
      {{else:}}
        <h2>No comments posted yet</h2>
      {{pass}}
      {{=form_activity}}
    </div>
    {{=form.custom.submit}}
    {{=form.custom.end}}

/dps
 

Silvian “Top 10 Answers” Cedru

unread,
Sep 6, 2022, 10:07:12 PMSep 6
to web2py-users
Sorry about that this would be the full code 


{{extend 'project/test.html'}}
{{include 'web2py_ajax.html'}}

<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <head></head>
  <title>Update</title>
  <meta name="viewport" content="width=device-width,initial-scale=1">

  <!-- That is how you go into folders in web2py
  <link rel="appleicon" href="{{=URL('static','img/file.PNG')}}"> -->

  <style>
   
    /* Style the tab */
    .tab {
      overflow: hidden;
      border: 1px solid #ccc;
      background-color: #f1f1f1;
    }

    .form-control {
      width: fit-content;
      width: auto;
    }

    /* Style the buttons inside the tab */
    .tab button {
      background-color: inherit;
      float: left;
      border: none;
      outline: none;
      cursor: pointer;
      padding: 14px 16px;
      transition: 0.3s;
      font-size: 17px;
    }

    /* Change background color of buttons on hover */
    .tab button:hover {
      background-color: #ddd;
    }

    /* Create an active/current tablink class */
    .tab button.active {
      background-color: rgb(233,105, 61);
    }

    /* Style the tab content */
    .tabcontent {
      display: none;
      padding: 6px 12px;
      border: 1px solid #ccc;
      border-top: none;
    }

    .header {
      padding: 60px;
      text-align: center;
      background: #E9693D;
      color: white;
      font-size: 30px;
    }
  </style>

  <body>
    <br>

    <div class="tab">
      <button class="tablinks" onclick="tab(event, 'Overview')" id="defaultOpen">Overview</button>
      <button class="tablinks" onclick="tab(event, 'Team')">Team</button>
      <button class="tablinks" onclick="tab(event, 'Third Parties')">Third Parties</button>
      <button class="tablinks" onclick="tab(event, 'Activity')">Activity</button>
    </div>

    {{=form.custom.begin}}

    <div id="Overview" class="tabcontent">
      <h3>General</h3>
      <br>
      <p>Project Name {{=form.custom.widget.project_name}}</p>
      <p>Project Description {{=form.custom.widget.project_description}}</p>
      <p>Project Country {{=form.custom.widget.project_country}}</p>
      <p>Equity Share{{=form.custom.widget.equity_share}}</p>
      <p>Strategy Initiative{{=form.custom.widget.strategy_initiative}}</p>
      <br>
      <h3>Technical Data</h3>
      <br>
      <p>Project Technology {{=form.custom.widget.technology}}</p>
      <p>Project Capacity {{=form.custom.widget.capacity_mw}}</p>
      <br>
      <h3>Development</h3>
      <br>
      <p>Project Development Phase {{=form.custom.widget.project_devlopment_phase}}</p>
      <p>Project Initiated {{=form.custom.widget.initiated}}</p>
      <p>Project Expected COD {{=form.custom.widget.expected_cod}}</p>
      <p>Project Status {{=form.custom.widget.status}}</p>
    </div> <div id="Team" class="tabcontent">
      <h3>Development</h3>
      <p>BD Team{{=form.custom.widget.bd_team}}</p>
      <p>BD Manager{{=form.custom.widget.bd_manager}}</p>
    </div>
    <div id="Third Parties" class="tabcontent">
      <!-- Problem with the database recheck later -->
    <P> Offtaker {{=form.custom.widget.offtaker}} </P>
    <p> Partner {{=form.custom.widget.partner}}</p>
    </div>

    <div id="Activity" class="tabcontent">
      {{if len(activities_project):}}
        <h2>Activity </h2>
        <br/>
        <p>
        {{for activity in activities_project:}}
          <p>{{=projects.project_name}} says <i>{{=activity.body}} Posted on {{=activity.created_on}} by {{=activity.created_by.first_name}}
            {{=activity.created_by.last_name}}</i>
          </p>
        {{pass}}
        </p>
      {{else:}}
        <h2>No comments posted yet</h2>
      {{pass}}
      {{=form_activity}}
    </div>
    {{=form.custom.submit}}
    {{=form.custom.end}}
   
 

 
   
 

    <script>
      function tab(evt, cityName) {
        var i, tabcontent, tablinks;
        tabcontent = document.getElementsByClassName("tabcontent");
     
        for (i = 0; i < tabcontent.length; i++) {
          tabcontent[i].style.display = "none";
        }
     
        tablinks = document.getElementsByClassName("tablinks");
     
        for (i = 0; i < tablinks.length; i++) {
          tablinks[i].className = tablinks[i].className.replace(" active", "");
        }
     
        document.getElementById(cityName).style.display = "block";
        evt.currentTarget.className += " active";
      }

      document.getElementById("defaultOpen").click();
    </script>

   
   
  </body>

</html>
Reply all
Reply to author
Forward
0 new messages