Problems tick checkbox using PHPUnit (Functional tests) - checkbox

I have problems to select the checkbox of the following code via PHPUnit.
<div id="user_project">
<input type="checkbox" id="user_project_1" name="user[project][]" value="1" checked="checked" />
<label for="user_project_1">Project 1</label>
<input type="checkbox" id="user_project_2" name="user[project][]" value="2" /><label for="user_project_2">Project 2</label>
<input type="checkbox" id="user_project_3" name="user[project][]" value="3" checked="checked" />
<label for="user_project_3">Project 3</label>
<input type="checkbox" id="user_project_4" name="user[project][]" value="4" checked="checked" />
<label for="user_project_4">Project 4</label>
<input type="checkbox" id="user_project_5" name="user[project][]" value="5" checked="checked" />
<label for="user_project_5">Project 5</label>
<input type="checkbox" id="user_project_6" name="user[project][]" value="6" checked="checked" />
<label for="user_project_6">Project 6</label>
<input type="checkbox" id="user_project_7" name="user[project][]" value="7" />
<label for="user_project_7">Project 7</label>
<input type="checkbox" id="user_project_10" name="user[project][]" value="10" /><label for="user_project_10">Project 10</label>
<input type="checkbox" id="user_project_12" name="user[project][]" value="12" /><label for="user_project_12">Project 12</label>
<input type="checkbox" id="user_project_13" name="user[project][]" value="13" />
<label for="user_project_13">Project 13</label>
</div>
Normally I will tick the checkboxes using "$form["Name of checkbox"]->tick();" - but i cannot change the name (because it is generated via Symfony2).
Can somebody help me?

Suppose you retrieve the form in the $form object, try this for select the 2nd element:
$select = $form->get('user[project]');
$cb = $select[1]; // the second table row
$cb->tick();
Hope this help

Related

PayFast Integration to React signature error

Hello I am trying to integrate PayFast to my ReactJS project but I am getting this error
signature : Generated signature does not match submitted signature
I do not understand because based on the docs https://developers.payfast.co.za/docs#step_2_signature we are to generate an Md5 hash then submit it through with the entire form
can I please get some assistance in resolving this I am using the default sandbox merchant_id and merchant_key
Code to PayFast Custom Form integration
<form action="https://sandbox.payfast.co.za​/eng/process">
<input
type="hidden"
name="merchant_id"
value={process.env.REACT_APP_MERCHANT_ID}
/>
<input
type="hidden"
name="merchant_key"
value={process.env.REACT_APP_MERCHANT_KEY}
/>
<input
type="hidden"
name="return_url"
value="http://127.0.0.1:3000/success"
/>
<input
type="hidden"
name="cancel_url"
value="http://127.0.0.1:3000/cart/cancel"
/>
<input type="hidden" name="name_first" value="Junior" />
<input type="hidden" name="name_last" value="Hlongwane" />
<input
type="hidden"
name="email_address"
value="jh0417783#gmail.com"
/>
<input type="hidden" name="cell_number" value=<entered my number> />
<input type="hidden" name="amount" value="800.00" />
<input type="hidden" name="item_name" value="Test Item" />
<input type="hidden" name="email_confirmation" value="1" />
<input
type="hidden"
name="signature"
value="f103e22c0418655fb03991538c51bfd5"
/>
<button className="Cart__checkOutButton">
PROCEED TO CHECKOUT
</button>
</form>

loop on a star rating

I am trying to loop on dynamic form with star rating. The issue is that this works in the first iteration only.
Here is my code: (with smarty).
<form action="">
forEach{ $lstCodesNotation as $oneCodeNotation}
<p>{$oneCodeNotation.description}</p>
<input class="star star-5" id="star-5" type="radio" name="star"/>
<label class="star star-5" for="star-5"></label>
<input class="star star-4" id="star-4" type="radio" name="star"/>
<label class="star star-4" for="star-4"></label>
<input class="star star-3" id="star-3" type="radio" name="star"/>
<label class="star star-3" for="star-3"></label>
<input class="star star-2" id="star-2" type="radio" name="star"/>
<label class="star star-2" for="star-2"></label>
<input class="star star-1" id="star-1" type="radio" name="star"/>
<label class="star star-1" for="star-1"></label>
{/foreach}
</form>
Your foreach is not write correctly, you have to put it into the { like this :
{foreach $lstCodesNotation as $oneCodeNotation}

Angular ng loop without a dom element

Say I have a block of html like the following and I need to loop through an array of objects and display a label for each option.
I can do this easily using ng-repeat for the labels and the input individually, but in order for my style framework to update the checked input correctly, the input needs to be directly above the label in the document.
How can I do this without wrapping each group of input + label in another dom element? (This would destroy the style of the list as well)
need:
<input type="radio" name="rGroup" value="1" id="r1" />
<label class="radio radio-plan-lg" for="r1">
Billed every<br><span>1 month</span>
</label>
<input type="radio" name="rGroup" value="2" id="r2" />
<label class="radio radio-plan-lg" for="r2">
Billed every<br><span>3 months</span>
</label>
<input type="radio" name="rGroup" value="3" id="r3" />
<label class="radio radio-plan-lg" for="r3">
Billed every<br><span>6 months</span>
</label>
not:
<input type="radio" name="rGroup" value="1" id="r1" />
<input type="radio" name="rGroup" value="2" id="r2" />
<input type="radio" name="rGroup" value="3" id="r3" />
<label class="radio radio-plan-lg" for="r1">
Billed every<br><span>1 month</span>
</label>
<label class="radio radio-plan-lg" for="r2">
Billed every<br><span>3 months</span>
</label>
<label class="radio radio-plan-lg" for="r3">
Billed every<br><span>6 months</span>
</label>
Use ng-repeat-start:
<input ng-repeat-start="item in array" type="radio" name="rGroup" value="{{item}}" id="r{{item}}" />
<label ng-repeat-end class="radio radio-plan-lg" for="r{{item}}">
Billed every<br><span>{{item}} month</span>
</label>
See Documentation - Special repeat start and end points

Calculate form progress with Angular js

I have a simple with two fields. Each field associated with two radio buttons.
I want to calculate the form progress..Markup of the form look like this
<fieldset>
<div>
<div class="btn-group">
<label class="radio-inline">
<input type="radio" name="radio" />
</label>
<label class="radio-inline">
<input type="radio" name="radio" />
</label>
</div>
<label for="FH1" class="radio-inline control-label">1st Option</label>
</div>
<br/>
<div>
<div class="btn-group">
<label class="radio-inline">
<input type="radio" name="radio" />
</label>
<label class="radio-inline">
<input type="radio" name="radio" />
</label>
</div>
<label for="FH1" class="radio-inline control-label">2nd Option</label>
</div>
</fieldset>
I have a directive define for formprogress
<formprogress progress={{progressValue}} />
Assume that "progressValue" is a scope variable, now I want to update this value somehow, to show the form progress.How it would possible?

use shell curl to post whith a checkbox array

The http code like this:
<input type="checkbox" value="1" name="checkbox[]">
<input type="checkbox" value="2" name="checkbox[]">
<input type="checkbox" value="3" name="checkbox[]">
<input type="checkbox" value="4" name="checkbox[]">
<input type="checkbox" value="5" name="checkbox[]">
<input type="checkbox" value="6" name="checkbox[]">
It will be checked some value more than one
I see that, checkbox like this is for php and have to be serialized and I want to use curl on unix shell to do this,what can i do?

Resources