0

I'll preface this by saying that I am asking for information, not a coding solution. At this point, it is unclear to me why EllisLab would intentionally do this.

I'm creating an edit form for a channel entry. Inside my {exp:channel:form} loop, which works, I try to output a date variable with specific formatting.

When I output the date variable once with a format parameter...

{p_date_available format="%Y-%m-%d"}

...the variable is not parsed on the front-end. However, if I place the date variable in my template twice, once without the format parameter and once with the format parameter, my problem is solved. Placement of these two instances of the variable is irrelevant.

Can anyone provide an explanation as to why the channel form tag does this?

EDIT: Here is a snippet of the code for understanding the parse order:

{exp:channel:form channel="product" class="styled-form" return="dashboard" datepicker="no" url_title="{segment_3}" require_entry="yes"}
    {exp:store:product entry_id="{entry_id}"}
        <input type="date" id="p_date_available" name="p_date_available" value="{p_date_available format="%Y-%m-%d"}" required/>
        <!-- put here to force EE parsing of formatted date variable-->
        <input type="hidden" value="{p_date_available}"/>
    {/exp:store:product}
{/exp:channel:form}
  • have you got an example template? The entire exp:channel:form syntax? I ask as I'm trying to work out if this might be a parsing order issue. I'nm also curious are you trying to put the formatted date into a value attribute on your form, or otherwise trying to show it in a message or something?? With an example I can easily run it up in my sandbox and see... – Blatant Jun 19 '15 at 14:34
  • There you go. @Blatant – Caleb Faruki Jun 19 '15 at 15:11
0

What results do you get without the exp:store:product tag pair? Also, why do you have this within the channel form??

I'm thinking it might have sometihng to do with this you see. Try this out nad let us know what happens :

{exp:channel:form channel="product" class="styled-form" return="dashboard" datepicker="no" url_title="{segment_3}" require_entry="yes"}
    <input type="date" id="p_date_available" name="p_date_available" value="{p_date_available format="%Y-%m-%d"}" required/>
{/exp:channel:form}

MY thinking is that aa product is basically a channel entry, so we can use the channel entry form to influence it, without the need for the store tags. I don't know why it would make it work, but its worth a trial and error thang!

| improve this answer | |
  • The form is meant to allow the user to edit the fields. So I display the current information so that they can compare it against the new values they are entering. – Caleb Faruki Jun 23 '15 at 18:31
  • Thanks, did you try my snippet above? This will tell usif its a channel form issue or something the store tag is introducing... – Blatant Jun 24 '15 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.