Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hello again,

I have a page called sales with a relation to page companies
Code: Select all
<cms:editable type='relation' name='company' masterpage='companies.php' has='one' /> 


and a sales transaction page with.

Code: Select all
<cms:editable type='relation' name='invoice' masterpage='sales.php' has='one'> </cms:editable>


Later in the sales page I have
Code: Select all
<cms:related_pages 'company' masterpage='companies.php' >
<cms:set client_id="<cms:show k_page_id />" 'global'/><!-- For use in new order line form -->
</cms:related_pages>


This will give the result when I use <cms:show client_id/> of the number 157 .

Now I tried to set this in a form to the relation like this;

Code: Select all
<cms:form 
    masterpage='sales_transactions.php'
    mode='create'
    enctype='multipart/form-data'
    method='post'
    anchor='0'
    >


<cms:if k_success >

<cms:set line_price = "<cms:show frm_price/>"/>
<cms:set line_amount = "<cms:show frm_amount/>"/>
<cms:set total_price = "<cms:mul line_price line_amount/>"/>


        <cms:db_persist_form
            _invalidate_cache='0'
            k_page_title="<cms:show sa/><cms:show sa_no/>-<cms:show frm_item/>"
            invoice_no="<cms:show sa_no/>"
            total="<cms:show total_price/>"
            invoice="<cms:show client_id/>"   
        />



Somehow this invoice="<cms:show client_id/>" isn't working, however when i set this to invoice='157' it works fine.. I tried all kinds of formatting options to get the show client_id working (cms:number_format) but didn't seem to work also.

What I'm doing wrong here ?
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
Hi Tom,

Since, as you say, invoice='157' works there should be wrong with the code.
We'll just need to know for sure the value contained in client_id variable at the point where we use it as
invoice="<cms:show client_id/>".

To debug, remove the cms:db_persist_form from the k_success condition and put in a <cms:dump_all /> instead. This will print out the values of all variables available at that point.

If you find that client_id does not contain the expected value, we'll have to find the reason. Perhaps there is another variable by the same name etc.

Hope this helps.
Hello KK,

I did those check's many times already also tried to use this in the form and then pass it to invoice= ...

Code: Select all
invoice="<cms:show frm_client_id/>"

<cms:input type="text" name="client_id" value="<cms:show client_id/>"/>


As you can see the client_id shows correct in the form field.
Image

Sorry .. replaced invoice="<cms:show frm_client_id/>" with invoice=frm_client_id this seems to work!
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
Strange. invoice="<cms:show frm_client_id/>" and invoice=frm_client_id should work just the same.

Anyways, I think you are right in passing the client_id through the form itself.
You can use type='hidden' for the input.
4 posts Page 1 of 1
cron