What i'm trying to achieve is to select a company by clicking a link and 
have a form open up with thee selected company name for the client to fill 
up the form for that company & submit it. But I am using LOAD to take 
advantage of ajax and prevent a page reload. The problem i am facing is 
that in using LOAD the form does not open with the company name, it says a 
company has not been selected and company name in the DB is set to NULL! 

*CONTROLLER*
def quotation():
    response.flash = T("PLEASE UNDERSTAND THAT ALL THE QUOTED ITEMS WILL BE 
ENTERED AND QUOTED ONE ITEM AT A TIME")
    quotation=db.Client_Details(request.args(0, cast=int))
    db.quotation.customer.default=quotation.id
    return locals()

def quotationLoad():
    form=SQLFORM(db.quotation)
    if form.process().accepted:
        response.flash=T('Client Quoted')
    return locals()


*LOAD PAGE*
{{=form}}


*VIEWS*
{{extend 'layout.html'}}

<script>
$(document).ready(function() {
    var interval = setInterval(function() {
        var momentNow = moment();
        $('#date-part').html(momentNow.format('DD MMMM YYYY') + ' '+ 
momentNow.format('dddd').substring(0,3).toUpperCase());
        $('#time-part').html(momentNow.format('hh:mm:ss A'));
    }, 100);
});
</script>

{{block header}}
<div class="jumbotron jumbotron-fluid" style="background-color: #333; 
color:white; padding:30px;word-wrap:break-word;">
  <div class="container center">
      <div class="appLogo2">PIQ v1.0</div>
      <div id="loginDetails">
          <span id='date-part'></span> | <span id="time-part"></span> | <span 
id="user" >Logged In User: {{if auth.user:}}{{=auth.user.first_name}} {{=
auth.user.last_name}}</span> <span id="logout" class="glyphicon 
glyphicon-log-out">{{=A('LOGOUT', _id="logingOut", _class="btn btn-info 
btn-lg", _href=URL('default', 'user', args='logout'))}}</span>
        {{pass}}

</div>
  </div>
</div>
{{end}}
<div id="bookings" style="border: solid 2px grey; border-radius: 10px; 
box-shadow: 10px 8px #888888; padding: 10px;">
 <div id="quote" class="formTitle">QUOTE A CLIENT</div>
    <div style="border: solid 1px red; border-radius: 10px; padding: 2px; 
font-style: italic; font-weight: bold;">
        <center>You are advised to Quote up to a maximum of 20 items in a 
single Quotation for a clear and readable Quotation.</center>
    </div>
    <br />
*{{=LOAD('default', 'quotationLoad.load', ajax=True)}}</div>*
<button onclick="topFunction()" id="myBtn" title="Go to top">TOP</button>

 I am not sure if my question is clear, but if I could achieve this it 
would be great for my application. Or alternatively help me find a way to 
prevent my page from scrolling back to top everytime a page refreshes after 
submitting a form.

Regards;

Mostwanted

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/13980eb1-f54a-4328-a72f-9c95846da037%40googlegroups.com.

Reply via email to