Separation of forms & also drop down menu alteration when object selected - joomla

In the image provided of my registration page, I wish to put a vertical separator inbetween the form on the left to have another form on the right to be completed for the registration but I have no idea how to do it.
http://puu.sh/1FJIA
Also the second part of my question pertains to the drop down menu, how would I put an extra option other than #_usergroups that when selected will alter the drop down menu to change into a text box? Below is the coding used for the xml.
<?xml version="1.0" encoding="UTF-8"?>
<form>
<fieldset name="default"
label="COM_USERS_REGISTRATION_DEFAULT_LABEL"
>
<field name="spacer" type="spacer" class="text"
label="COM_USERS_REGISTER_REQUIRED"
/>
<field name="name" type="text"
description="COM_USERS_REGISTER_NAME_DESC"
filter="string"
label="COM_USERS_REGISTER_NAME_LABEL"
message="COM_USERS_REGISTER_NAME_MESSAGE"
required="true"
size="30"
/>
<field name="username" type="text"
class="validate-username"
description="COM_USERS_DESIRED_USERNAME"
filter="username"
label="COM_USERS_REGISTER_USERNAME_LABEL"
message="COM_USERS_REGISTER_USERNAME_MESSAGE"
required="true"
size="30"
validate="username"
/>
<field name="password1" type="password"
autocomplete="off"
class="validate-password"
description="COM_USERS_DESIRED_PASSWORD"
field="password2"
filter="raw"
label="COM_USERS_REGISTER_PASSWORD1_LABEL"
message="COM_USERS_REGISTER_PASSWORD1_MESSAGE"
required="true"
size="30"
validate="equals"
/>
<field name="password2" type="password"
autocomplete="off"
class="validate-password"
description="COM_USERS_REGISTER_PASSWORD2_DESC"
filter="raw"
label="COM_USERS_REGISTER_PASSWORD2_LABEL"
message="COM_USERS_REGISTER_PASSWORD2_MESSAGE"
required="true"
size="30"
/>
<field name="email1" type="email"
description="COM_USERS_REGISTER_EMAIL1_DESC"
field="id"
filter="string"
label="COM_USERS_REGISTER_EMAIL1_LABEL"
message="COM_USERS_REGISTER_EMAIL1_MESSAGE"
required="true"
size="30"
unique="true"
validate="email"
/>
<field name="email2" type="email"
description="COM_USERS_REGISTER_EMAIL2_DESC"
field="email1"
filter="string"
label="COM_USERS_REGISTER_EMAIL2_LABEL"
message="COM_USERS_REGISTER_EMAIL2_MESSAGE"
required="true"
size="30"
validate="equals"
/>
<field name="title" type="sql"
default="-None Listed-"
label="Select your University"
description="Select the University you are currently attending, if
it's not on the list then create it below"
query="SELECT title FROM #__usergroups WHERE ID > '8 ' "
required="true"
/>
<field
name="captcha"
type="captcha"
label="COM_USERS_CAPTCHA_LABEL"
description="COM_USERS_CAPTCHA_DESC"
validate="captcha"
/>
</fieldset>
</form>

1. Vertical separator:
you can use a hack i.e. create some fields which will output markup.
The idea here is to insert an extra
<div style='width:50%'>
before the first field;
Then a
</div><div style='width:49%;border-left:1px dashed black'>
where you want the separator
and finally a at the end.
Create three new spacer fields.
You can either insert properly escaped html directly:
<field type="spacer" name="splitterinit" label="<div>" />
or put the html as language constants in the language file:
SPLITTER_MID="</div><div style='width:49%;border-left:1px dashed black'>"
and simply use the constant in the .xml:
<field type="spacer" name="splittermid" label="SPLITTER_MID" />
2. Extra text option:
Easy: Simply add a text field below to allow the user to type in.
Harder: Create a custom element, there you can write php and make it
as you want it
3. A word of advice
Chronoforms features a user registration override that lets you define all the fields you want, and for sure you'll find more similar extensions on the JED
Also, all community solutions feature custom profiles.

Related

Joomla - Convenient Template Upgrades

I recently migrated a website from Jekyll to Joomla (currently 3.9). Therefore I made an own Joomla Template. It is already in production, but of course it gets regular updates. I use a quite standard development/release approach, versioning like 1.1, 1.2, 1.2.1 and so on. These numbers are always up to date in templateDetails.xml. Nothing special so far. But this has some very inconvenient issues:
Every time I upgrade the template I have to set a different template/style as default, uninstall the old version, upload and install the current version and set its style as new default. Is there really no better way for upgrading a template, especially if it has an higher version?
For each update all my configurations of the style get lost. I already put the defaults accordingly in the templateDetails.xml, so I don't have to do this on every upgrade. But I can imagine this may cause problems when I change the configuration in the back end without updating the template. This would result in potential configuration loss after an upgrade. Can I keep any style configuration when upgrading?
Third, I'm thinking of using different styles for different pages on my website. These would also get lost when upgrading, so I'd have to redefine them regularly. I also would have to reconfigure all pages using these styles to use them again. Is there a way to define several styles in templateDetails.xml, so they are stored in my zip file?
Edit: As Irfan asked for, here is my current templateDetails.xml
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.8" type="template">
<name>####</name>
<creationDate>2018-11-03</creationDate>
<author>####</author>
<authorEmail>#########.de</authorEmail>
<authorUrl>https://###.##.##</authorUrl>
<copyright>SV FOO BAR e.V.</copyright>
<license>TBA</license>
<version>0.4.0-SNAPSHOT</version>
<description>Joomla-Template fuer die Vereinshomepage des SV FOO BAR e.V.</description>
<files>
<filename>index.php</filename>
<filename>templateDetails.xml</filename>
<filename>template_preview.png</filename>
<filename>template_thumbnail.png</filename>
<filename>main.css</filename>
<filename>favicon.ico</filename>
<folder>images</folder>
<folder>html</folder>
<folder>language</folder>
<folder>js</folder>
</files>
<positions>
<position>breadcrumb</position>
<position>left</position>
<position>right</position>
<position>footer</position>
</positions>
<languages folder="language">
<language tag="de-DE">de-DE/de-DE.tpl_svFOOBAR.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="advanced">
<field
name="sitedescription"
type="text"
label="JGLOBAL_DESCRIPTION"
description="JGLOBAL_SUBHEADING_DESC"
default="This is my slogan"
filter="string" />
<field
name="copyright-from"
type="number"
default="2005"
label="TPL_SVFOOBAR_FIELDS_LABEL_COPYRIGHT_FROM"
description="TPL_SVFOOBAR_FIELDS_DESCRIPTION_COPYRIGHT_FROM"
step="1"
required="true" />
</fieldset>
<fieldset name="cookieconsent">
<field
type="spacer"
name="cookieconsent_separator_general"
label="TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_SEPARATOR_general" />
<field
name="cookieconsent_activate"
type="checkbox"
label="TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_ACTIVATE"
description="TPL_SVFOOBAR_FIELDS_DESCRIPTION_COOKIECONSENT_ACTIVATE"
checked="1"
value="1" />
<field
name="cookieconsent_position"
type="list"
default="top"
required="true"
label="TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_POSITION"
description="TPL_SVFOOBAR_FIELDS_DESCRIPTION_COOKIECONSENT_POSITION">
<option value="top">TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_POSITION_BANNER_TOP</option>
<option value="top-pushdown">TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_POSITION_BANNER_TOP_PUSHDOWN</option>
<option value="bottom">TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_POSITION_BANNER_BOTTOM</option>
<option value="bottom-left">TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_POSITION_FLOATING_LEFT</option>
<option value="bottom-right">TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_POSITION_FLOATING_RIGHT</option>
</field>
<field
type="spacer"
name="cookieconsent_separator_colors"
label="TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_SEPARATOR_COLORS" />
<field
name="cookieconsent_color_banner"
required="true"
type="color"
default="#efefef"
label="TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_COLOR_BANNER"
description="TPL_SVFOOBAR_FIELDS_DESCRIPTION_COOKIECONSENT_COLOR_BANNER" />
<field
name="cookieconsent_color_button"
required="true"
type="color"
default="#8ec760"
label="TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_COLOR_BUTTON"
description="TPL_SVFOOBAR_FIELDS_DESCRIPTION_COOKIECONSENT_COLOR_BUTTON" />
<field
name="cookieconsent_color_banner_text"
required="true"
type="color"
default="#404040"
label="TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_COLOR_BANNER_TEXT"
description="TPL_SVFOOBAR_FIELDS_DESCRIPTION_COOKIECONSENT_COLOR_BANNER_TEXT" />
<field
name="cookieconsent_color_button_text"
required="true"
type="color"
default="#ffffff"
label="TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_COLOR_BUTTON_TEXT"
description="TPL_SVFOOBAR_FIELDS_DESCRIPTION_COOKIECONSENT_COLOR_BUTTON_TEXT" />
<field
type="spacer"
name="cookieconsent_separator_texts"
label="TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_SEPARATOR_TEXTS" />
<field
name="cookieconsent_learnmore_text"
type="text"
default="Mehr erfahren"
label="TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_LEARNMORE_TEXT"
description="TPL_SVFOOBAR_FIELDS_DESCRIPTION_COOKIECONSENT_LEARNMORE_TEXT"
filter="string" />
<field
name="cookieconsent_learnmore_link"
type="url"
default="impressum-datenschutz"
label="TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_LEARNMORE_LINK"
description="TPL_SVFOOBAR_FIELDS_DESCRIPTION_COOKIECONSENT_LEARNMORE_LINK" />
<field
name="cookieconsent_message"
type="textarea"
default="Um die Funktionalität und den Inhalt der Website zu optimieren, verwenden wir Cookies. Durch die Nutzung unserer Website stimmst du der Verwendung von Cookies zu."
label="TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_MESSAGE"
description="TPL_SVFOOBAR_FIELDS_DESCRIPTION_COOKIECONSENT_MESSAGE"
rows="10"
cols="5" />
<field
name="cookieconsent_dismiss_button"
type="text"
default="Verstanden"
label="TPL_SVFOOBAR_FIELDS_LABEL_COOKIECONSENT_DISMISS_BUTTON"
description="TPL_SVFOOBAR_FIELDS_DESCRIPTION_COOKIECONSENT_DISMISS_BUTTON" />
</fieldset>
</fields>
</config>
</extension>
Try updating the extension tag to include a method of upgrade:
<extension version="3.8" type="template" method="upgrade" client="site">

Add a link in the label of a Joomla form element

I'm trying to add a link to a field in the joomla contact form. I'm trying to achieve this:
<field name="contact_terms"
type="checkbox"
id="contact-terms"
description=""
label="I agree to <a href='http://example.com/terms'>Terms and Conditions</a>"
default="0"
value="1"
required="true"
/>
but it gives an error and I'm just very very new to joomla. How should it be done?

Do I need separate Struts Action for each form?

Do I need separate Struts action for each form?
Currently, one web page have two forms in jsp. I currently put all validation code in validate() in the Action class. The problem is that it appears the net result is that Form A will then be linked to Form B and vice versa since the validation code is inside the same Action class.
So am I correct that if I want the two forms to be validated independently, then I would require two separate Actions?
Form A:
<font color="red" size="2"><s:actionerror /> <s:fielderror /></font>
<s:form action="NewcreateUser" method="post">
<s:textfield type="text" name="form1filed" key="temp" size="11" label="Mobile_Num" required="true"></s:textfield><br />
<s:submit value="Continue" id="continueSignUp" validate="true"></s:submit>
</s:form>
Form B:
<font color="red" size="2"><s:actionerror /> <s:fielderror /></font>
<s:form action="NewcreateUser" method="post">
<s:textfield type="text" name="form2filed" key="formb" size="11" label="Mobile_Num" required="true"></s:textfield><br />
<s:submit value="Continue" id="continueSignUp" validate="true"></s:submit>
</s:form>
Here You can validate your fields,both form1filed,form2filed with the same Action class
NewcreateUser,And the NewcreateUser-validation.xml file looks like this,
<field name="form1filed">
<field-validator type="required" short-circuit="true">
<message key="form1filed Is Required" />
</field-validator>
</field>
<field name="form2filed">
<field-validator type="required" short-circuit="true">
<message key="form2filed Is Required" />
</field-validator>
</field>

Joomla: what is wrong with my plugins XML - config-section is not shown?

I am trying to upgrade an old mambot. It's possible that there are still bugs in the code, but even the config-screen does not show up, only the basic pi-parameters are there, none of mine. What am I missing?
<?xml version="1.0" encoding="iso-8859-1" ?>
<extension type="plugin" group="content" version="1.6" method="upgrade">
<name>mb_append</name>
<creationDate>June 08, 2013</creationDate>
<version>1.1</version>
<author>Michael Baas</author>
<authorName>Michael Baas</authorName>
<authorEmail>michael#mbaas.de</authorEmail>
<authorUrl>mbaas.de</authorUrl>
<description>
<![CDATA[
<p>Very simple bot to append constant <i>(configureable)</i> text (i.e. <br>-tags!) to the
article and the output. 'Output' includes the "ReadMore..."-Link (but not the
navigation). (However, if you absolutely
need this, let me know and I may implement it, but it's a bit tricky, so I would only
do this if somebody can convince me he needs it ;)</p>
<p>In case you want to insert multiple texts between the output of other plugins etc., you can
create further instances of this plugin by simply renaming the PHP and XML in the
installation-ZIP AND by adjusting the names in the XML and then just install your
'new' mambot! :)</p>
<p><b>Links</b> <i>(automatically open in new window)</i>:
<ul>
<li>Michael's Homepage
</ul>
]]>
</description>
<copyright>(c) 2013 Michael Baas</copyright>
<license>GPL</license>
<files>
<filename plugin="mb_append">mb_append.php</filename>
</files>
<config>
<fields name="config">
<fieldset name="basic">
<field name="txt_app" type="text" default="" label="Append 2 article" description="The text you want to append to the article" size="40" />
<field name="txt" type="text" default="" label="Append 2 output" description="The text you want to append to the output" size="40"/>
<field name="look4txt" type="radio" value="1" label="Check if txt already there?" description="Check if the specified text has already been added to the text and do not add again if this option is activated.">
<option value="0">No</option>
<option value="1">Yes</option>
</field>
<field name="excat" type="text" default="" label="Categories to EXCLUDE" description="Comma-separated list of IDs" size="40"/>
<field name="exid" type="text" default="" label="Article-IDs to EXCLUDE" description="Comma-separated list of IDs OR a 'less-than'-sign (arrow-left) followed by ONE number to exclude all IDs smaller than thew number you specified!" size="40" />
</fieldset>
</fields>
</config>
</extension>
Change the <fields name="config"> to <fields name="params">. This might work then.

Obtaining stray text adjacent to selected radio button using xpath in watir

I have some stray text next to radio buttons in a radio button group. I tried to obtain it using xpath and watir, but I had no luck with it. Here's some sample HTML for it
<html>
<head></head>
<body>
<input type="radio" name="options" value="No">No <br />
<input type="radio" name="options" value="Yes">Yes <br />
<input type="radio" name="options" value="Maybe">Maybe <br />
</body>
</html>
I can obtain the selected radio button using xpath by
selectedRadio = browser.radio(:xpath,"//input[#checked and #name='options']")
How can I obtain say Yes, No, Maybe if the corresponding radio buttons are selected? I also tried to obtain it using Watir, but the .text method would not work on the Watir::RadioButton object which would be true since the texts are stray texts.
Thanks in advance.
That HTML given is not well-formed XML, so I think the expression will depend on how Waitr parses the input. If it thinks that the text is a child of the input elements, like this:
<input type="radio" name="options" checked="checked" value="No">No </input><br />
<input type="radio" name="options" value="Yes">Yes </input><br />
<input type="radio" name="options" value="Maybe">Maybe </input><br />
Then use this expression:
//input[#checked and #name='options']/text()
If, on the other hand, it automatically closes the input and treats the text as a sibling, like this:
<input type="radio" name="options" checked="checked" value="No"/>No <br />
<input type="radio" name="options" value="Yes"/>Yes <br />
<input type="radio" name="options" value="Maybe"/>Maybe <br />
Then use the following expression:
//input[#checked and #name='options']/following-sibling::text()[1]
My guess is that this second one is the correct one, since you already said that .text did not work.
Ask the developer to make the page more testable by putting the text associated with the radio button inside a label associated with the button via an ID value
<form>
<input type="radio" name="sex" id="male" />
<label for="male">Male</label>
<br />
<input type="radio" name="sex" id="female" />
<label for="female">Female</label>
</form>
Then you can get the ID for the selected button, and find the associated label text fairly easily.
Seriously, it's a likely a lot easier for them to do that than it is for you to have to deal with sloppy page code. It also offers them a lot more formatting options (via CSS) to have that text inside a label container. Win all around.

Resources