We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27716
    • 126 Posts
    Hi Guys,

    Im using Formit and Formit2Resource to add pages to my site for a form.

    I want to be able to assign the page title to BOTH the pagetitle and alias.

    Any clues on how to do this?

    This is my form code below.

     <label for="pagetitle">
            Question:
            <span class="error">[[+fi.error.pagetitle]]</span>
        </label>
        <input style="width:270px;" id="pagetitle" name="pagetitle:required" type="text" value="[[+fi.pagetitle]]" />
        <br/>
      • 4172
      • 5,888 Posts
      you can try to add this lines:

      $pagetitle=$doc->get('pagetitle');
      $alias = $doc->cleanAlias($pagetitle);
      $doc->set('alias',$alias);


      like that:


      $allFormFields = $hook->getValues(); 
      foreach ($allFormFields as $field=>$value)
      {
      
         if ($field !== 'spam' && $field !== 'resource_id'){
               $doc->set($field, $value);
          }
      }
      
      $pagetitle=$doc->get('pagetitle');
      $alias = $doc->cleanAlias($pagetitle);
      $doc->set('alias',$alias);
      
      $doc->set('template', '1');
      $doc->save();
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 27716
        • 126 Posts
        Hi Bruno,

        Thanks so much!

        Tested and working perfectly...

        Alsonoticed thar unlike evolution, Revolution auto sanitizes these aliases. Happy Happy.

        Stuart