Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2013-06-17 07:43:43
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
custom field as an url
my template:
<table class="kalender"><txp:article form="kalender" limit="200" /></table>
form “kalender”:
<tr><td><txp:posted format="%d.%m.%Y" /></td>
<td><a href="<txp:custom_field name="url" />"><txp:title /></a></td><td><txp:custom_field name="asukoht" /></td><td><txp:custom_field name="distants" /></td><td><txp:custom_field name="korraldaja" /></td></tr>
is it correct code?
anyway, it works until i insert some webpage full url (http://www…) into custom field named ‘url’. then i get error: sorry, the form could not be submitted!
the html output of that form:
<table class="kalender"><tr><td>10.08.2012</td>
<td><a href="">Raplarull</a></td><td>Rapla, EST</td><td>20km, 42km</td><td>EMT</td>
</tr>
</table>
?
Offline
Re: custom field as an url
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: custom field as an url
Gallex wrote:
is it correct code?
Default setting of custom fields is to escape html. You should change the setting by adding escape="" in your form.
<txp:custom_field name="url" escape="" />
You should also check if the custom field is not empty. If so you end up with an empty <a href="">
This will be something like:
<txp:if_custom_field name="url"><a href="<txp:custom_field name="url" escape="" />"><txp:title /></a><txp:else /><txp:title /></txp:if_custom_field>
This may be not related to the popup error you see, but you never know…
Last edited by kees-b (2013-06-17 10:01:57)
Offline
#4 2013-06-17 13:11:06
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Re: custom field as an url
kees-b wrote:
This may be not related to the popup error you see, but you never know…
…still, ‘sorry, the form could not be submitted!’ :(
Offline
Re: custom field as an url
Do you use a plugin that works on custom fields?
Did you check your error.log (or equivalent)?
Offline
Re: custom field as an url
Also do you use the mlp plugin?
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#7 2013-06-17 15:49:43
- milosevic
- Member

- From: Madrid, Spain
- Registered: 2005-09-19
- Posts: 390
Re: custom field as an url
I got the same problem than Gallex. My custom_field name called “web” works pefectly with values like “www.foo.com”, “ttp://www.foo.com” but not with “http://www.foo.com. I have tried all combinations of” and “/” and it works great but with “http://”, so in apperance the text “http://” blocks the article saving (perhaps a security issue of a plugin?)
<txp:rocks/>
Offline
Re: custom field as an url
milosevic wrote:
I got the same problem than Gallex. My custom_field name called “web” works pefectly with values like “www.foo.com”, “ttp://www.foo.com” but not with “http://www.foo.com. I have tried all combinations of” and “/” and it works great but with “http://”, so in apperance the text “http://” blocks the article saving (perhaps a security issue of a plugin?)
If that is the case you could try
<txp:if_custom_field name="url">
<a href="http://<txp:custom_field name="url" escape="" />"><txp:title /></a><txp:else /><txp:title /></txp:if_custom_field>
In this way all you will need to add is the rest of the url.
I use a custom field in a very similar way without any problems. I’m wondering if milosevic’s theory is right for Alesh. I would disable all plugins and see if the field can be saved.
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#9 2013-06-18 10:04:21
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Re: custom field as an url
Do you use a plugin that works on custom fields? Also do you use the mlp plugin?
no
Did you check your error.log (or equivalent)?
no
<txp:if_custom_field name=“url”>
<a href=“http://<txp:custom_field name=“url” escape=”“ />”><txp:title /></a><txp:else /><txp:title /></txp:if_custom_field>
In this way all you will need to add is the rest of the url.
this way it’s really working, great! thank’s colak!
I use a custom field in a very similar way without any problems. I’m wondering if milosevic’s theory is right for Alesh. I would disable all plugins and see if the field can be saved.
disabled, couldn’t to save
Offline
Offline
Re: custom field as an url
Gallex, can you capture the network traffic with Firebug or something similar when you click “Save” and receive the notorius “Sorry, the form could not be submitted. Please try again later.” message?
I am interested in your server’s response. It usually looks something like this:
;
$(document).ready(function() {
$("#messagepane").html("<span id=\"message\" class=\"success\">.
Offline
Re: custom field as an url
You might want to check jukka’s reply here
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#13 2013-06-19 08:57:01
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Re: custom field as an url
wet wrote:
Gallex, can you capture the network traffic with Firebug or something similar when you click “Save” and receive the notorius “Sorry, the form could not be submitted. Please try again later.” message? I am interested in your server’s response. It usually looks something like this: $(document).ready(function() { $(“#messagepane”).html(“<span id=\“message\” class=\“success\”>.
hmm…which firebug tool i need to use for that? web console, debugger, inspector…which? cause i dont’t know, where i should look for.
Offline
#14 2013-06-19 09:25:44
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,331
Re: custom field as an url
this? found it almost at the end of debugger
<script type="text/javascript">
$('#write-timestamp input.year,#write-timestamp input.month,#write-timestamp input.day,#write-timestamp input.hour,#write-timestamp input.minute,#write-timestamp input.second').change(
function() {
$('#publish_now').prop('checked', false);
$('#reset_time').prop('checked', false);
});
</script>
Offline
Re: custom field as an url
Both Firefox and Chrome offer debugging tools by default, meaning despite the common belief, you don’t really need Firebug. What you posted is not what Robert is after. The debugger tab, if I remember correctly, shows any application code the browser has evaluated during the recorded instance. That what you posted is just an embedded JavaScript snippet from the HTML page. What you should be interested at is either web console, or network tab depending on what browser you are using.
- Open a new browser tab with your Textpattern control panel open with.
- Open up your browser’s web developer tools/inspector. In Firefox its located at Tools > Developer > Web Console. In Chrome its under the non-standard Menu > Tools > Developer, once open select the Network tab.
- If you are using Firefox make sure “Log request and response bodies” is selected under Net menu. Otherwise it will only log headers (at least for anything that is cached).
- Open up an existing article in the Textpattern’s Write editor.
- Enter in the URL to the custom field.
- Click the Save button to save the article.
- In the Web Console or Network tab (if on Chrome) you will see requests being logged in. Click the new POST request that will be logged in it (the one that resource is set as
index.phplikely). Click it open, and you will be able to see the response body and headers.
Last edited by Gocom (2013-06-19 11:00:50)
Offline