Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Valid CSRF Token Required

I added a new page to the OSTicket version 10 Beta and I am trying to auto-populate data based on a select option value. I have a customer that could have multiple locations and each location has a different address, contact, email, etc...

When you select a different location in the dropdown it does a page submit and I get this error:

Valid CSRF Token Required

If I take copy that querystring, hit back in the browser and refresh the page so that it's working properly and paste that querystring into the url it works. It doesn't change the location in the select option but all the other data works so the problem is that onchange event with the select. Here is the code:

<form id="customer_form" action="customers.php?t=customer<?='&id='.$cust->getId()?>" method="post">
            <table style="width:100%;border:0;border-collapse:collapse;border-spacing:0;padding:2px">
                     <td width=50%>   
                        <table class="ticketinfo" style="width:100%;border:0;border-collapse:collapse;border-spacing:1;padding:3;margin:0 auto;text-align:left;">
                            <tr height=30 valign=bottom>   
                                <th>Site Name</th>
                                    <select name="location" onchange='document.getElementById("customer_form").action+="&sub_id="+this.value;document.getElementById("customer_form").submit();'>
                                         if (($locs=Cust::getLocations($cust->getId()))) {
                                               foreach ($locs as $loc) {
                                                  $sel=($_REQUEST['sub_id'] && $_REQUEST['sub_id']==$id)?'selected="selected"':'';
                                                  echo sprintf('<option value="%d" %s>%s</option>',$loc[locID],$sel,$loc['locName']);

Why might this be happening?

Sign In or Register to comment.