Customising the user form for an account manager page


(Ben Chapman) #1

Squiz Matrix v5.4.0.2

I’m having a problem creating a create account form for an account manager.

I want to create a custom form. But I don’t want to create the input fields for the form using the keyword replacements $details-F_username% and %details-email%, because I want to include my own classes in the input tags and I don’t want a size specified for the input field. However, if I simply include the input tags myself, I get the messages “Username is required to send the validation email” and “Email is required to send the validation email”.

If I do create the fields using the keyword replacements, the form works. But even if I copy the input tags created by the keyword replacements and use that in place of the keyword replacements, it won’t work.

Is there something I am missing? Is some other code generated by the keyword replacements that I am not catching?

Ben.


(Bart Banda) #2

Your best option for adding custom classes to the input fields is to just to a ^replace keyword modifier on the form field keywords.

For example:

%details-F_name^replace:sq-form-field:form-control%

Or the commit button for example:

%commit_button_clean^replace:sq-form-field:btn btn-primary^replace:Commit:Save%

You can also add extra attributes like this:

%details-F_name^replace:sq-form-field":form-control" placeholder="Enter a name"%

Would that work?


#3

Login form customisation on 5.1.3:

%login_form^replace:<table border=\"0\">:<fieldset>^replace:<\/table>:</fieldset>^replace:<tbody>:^replace:<\/tbody>:^replace:<tr>:<div>^replace:<\/tr>:</div>^replace:<td valign=\"top\">Username<\/td>:<label for="SQ_LOGIN_USERNAME">Username</label>^replace:name="SQ_LOGIN_USERNAME":name="SQ_LOGIN_USERNAME" tabindex="1"^replace:value="Enter your username here":placeholder="e.g. MyName""^replace:<td valign=\"top\">Password<\/td>:<label for="SQ_LOGIN_PASSWORD">Password</label><a href="./?a=97204" title="Reset your password">Forgot your password?</a>^replace:name="SQ_LOGIN_PASSWORD":name="SQ_LOGIN_PASSWORD" tabindex="2"^replace:class="sq-form-field" id="SQ_LOGIN_SUBMIT":class="sq-form-field button button--secondary" id="SQ_LOGIN_SUBMIT"^replace:<td valign=\"top\">:^replace:<\/td>:%

Have fun :grinning:


(Ben Chapman) #4

Thanks Bart. I was able to manipulate things to my liking.


(Ben Chapman) #5

That’s amazing Petri. I am going to have a go customising the login form using this approach.


#6

I was hoping they’d be using divs instead of tables by now :smiley:


(Bart Banda) #7

You don’t have to use the keywords, you can hardcode those form fields as well if you want.
Ie:

<input type="text" name="SQ_LOGIN_USERNAME" size="25" title="Username" class="my-custom-class" id="SQ_LOGIN_USERNAME" placeholder="Username" required>


(Ben Chapman) #8

Bret,

If I try to use hard coded fields for username and email address for the registration form, the form fails to send and I get the messages “Username is required to send the validation email” and “Email is required to send the validation email”.


(Ben Chapman) #9

I used to be able to hard code fields. My latest Matrix upgrade broke my account manager and asset builder forms.


(Bart Banda) #10

That’s weird, I’ve just confirmed it working on 5.4.1.2 and I don’t think we’ve fixed any bugs regarding this functionality since your version.

Are you sure the username is getting HTML printed correct as per exactly what the %details-F_username% keyword gets you?


(Ben Chapman) #11

Yes, quite sure.

It has occurred to me that there is a bug in my system (rather than in the Matrix version). I have been able to get asset builders to work by fiddling around with things but without changing the content of the page. However, I haven’t managed to work out how I managed to get it to work. It seems to have something to do with whether or not I have interacted with the page/site. For example, it makes a difference whether I am logged in or not.